summaryrefslogtreecommitdiff
path: root/addons/website_rating_project_issue
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2015-03-10 11:11:59 +0100
committerJérome Maes <jem@openerp.com>2015-03-10 13:05:44 +0100
commitf798d843228b93d9062d492e38bfc7eeab2f2dfd (patch)
tree2cd6b2e1d98e2f89f3aba638c2dec67d3487f1d1 /addons/website_rating_project_issue
parent87ac4da8077277ac46aa647f9599c8c26afdcbf5 (diff)
[FIX] website_rating_project_issue : fix the domain to retrieve rating of particular project and use website.image_url to display user avatar.
Diffstat (limited to 'addons/website_rating_project_issue')
-rw-r--r--addons/website_rating_project_issue/controllers/main.py9
-rw-r--r--addons/website_rating_project_issue/views/website_rating_project.xml12
2 files changed, 11 insertions, 10 deletions
diff --git a/addons/website_rating_project_issue/controllers/main.py b/addons/website_rating_project_issue/controllers/main.py
index cd09ea40f6e..6b10139d7e1 100644
--- a/addons/website_rating_project_issue/controllers/main.py
+++ b/addons/website_rating_project_issue/controllers/main.py
@@ -9,21 +9,22 @@ class WebsiteRatingProject(http.Controller):
@http.route(['/project/rating/'], type='http', auth="public", website=True)
def index(self, **kw):
- projects = request.env['project.project'].search([])
+ projects = request.env['project.project'].search([('is_visible_happy_customer', '=', 1)])
values = {'projects' : projects}
return request.website.render('website_rating_project_issue.index', values)
@http.route(['''/project/rating/<model("project.project", "[('is_visible_happy_customer','=',1)]"):project>'''], type='http', auth="public", website=True)
def page(self, project=None, **kw):
# create domain for rating
- domain = [('res_model', '=', 'project.issue')]
+ issues = request.env['project.issue'].search([('project_id', '=', project.id)])
+ domain = [('res_model', '=', 'project.issue'), ('res_id', 'in', issues.ids)]
ratings = request.env['rating.rating'].search(domain, order="id desc", limit=100)
yesterday = (datetime.date.today()-datetime.timedelta(days=-1)).strftime('%Y-%m-%d 23:59:59')
stats = {}
for x in (7, 30, 90):
- todate = (datetime.date.today()-datetime.timedelta(days=-x)).strftime('%Y-%m-%d 00:00:00')
- domdate = domain + [('create_date','<=',yesterday),('create_date','>=',todate)]
+ todate = (datetime.date.today()-datetime.timedelta(days=x)).strftime('%Y-%m-%d 00:00:00')
+ domdate = domain + [('create_date', '<=', yesterday), ('create_date', '>=', todate)]
stats[x] = {0: 0, 5: 0, 10: 0}
rating_stats = request.env['rating.rating'].read_group(domdate, [], ['rating'])
total = reduce(lambda x, y: y['rating_count']+x, rating_stats, 0)
diff --git a/addons/website_rating_project_issue/views/website_rating_project.xml b/addons/website_rating_project_issue/views/website_rating_project.xml
index 115f1fd9e8f..cce51b3a2e8 100644
--- a/addons/website_rating_project_issue/views/website_rating_project.xml
+++ b/addons/website_rating_project_issue/views/website_rating_project.xml
@@ -74,21 +74,21 @@
<div class="oe_rate">
<img src='/rating/static/src/img/rating_10.png' alt="Happy Feedback" class="pull-left" style="width:24px"/>
<div class="progress mt4">
- <div t-attf-class="progress-bar" role="progressbar" t-attf-style="width: #{stats[duration][10]}%;">
+ <div t-attf-class="progress-bar progress-bar-success" role="progressbar" t-attf-style="width: #{stats[duration][10]}%;">
<t t-esc="stats[duration][10]"/>%%
</div>
</div>
</div><div class="oe_rate mt16">
- <img src='/rating/static/src/img/rating_5.png' alt="Happy Feedback" class="pull-left" style="width:24px"/>
+ <img src='/rating/static/src/img/rating_5.png' alt="Normal Feedback" class="pull-left" style="width:24px"/>
<div class="progress mt4">
- <div t-attf-class="progress-bar" role="progressbar" t-attf-style="width: #{stats[duration][5]}%;">
+ <div t-attf-class="progress-bar progress-bar-warning" role="progressbar" t-attf-style="width: #{stats[duration][5]}%;">
<t t-esc="stats[duration][5]"/>%%
</div>
</div>
</div><div class="oe_rate mt16">
- <img src='/rating/static/src/img/rating_0.png' alt="Happy Feedback" class="pull-left" style="width:24px"/>
+ <img src='/rating/static/src/img/rating_0.png' alt="Bad Feedback" class="pull-left" style="width:24px"/>
<div class="progress mt4">
- <div t-attf-class="progress-bar" role="progressbar" t-attf-style="width: #{stats[duration][0]}%;">
+ <div t-attf-class="progress-bar progress-bar-danger" role="progressbar" t-attf-style="width: #{stats[duration][0]}%;">
<t t-esc="stats[duration][0]"/>%%
</div>
</div>
@@ -131,7 +131,7 @@
<h3 class="page-header">Team</h3>
<div class="media" t-foreach="team" t-as="user">
<div class="pull-left">
- <img t-att-src="'data:image/png;base64,' + user.image_small" class="img-rounded" t-att-alt="user.name" style="width: 32px"/>
+ <img t-att-src="website.image_url(user, 'image_small')" class="img-rounded" t-att-alt="user.name" style="width: 32px"/>
</div>
<div class="media-body">
<h5><t t-esc="user.name"/></h5>