summaryrefslogtreecommitdiff
path: root/addons/website_rating/static/src/js/website_mail.js
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2019-02-18 09:31:57 +0000
committerThibault Delavallée <tde@odoo.com>2019-02-21 16:38:14 +0000
commit7d1af42c0630d02b2027d07dd3d20aec3d22ccbe (patch)
tree7bf2e6e365c1e1cab9cb25d2ae860de003b0395d /addons/website_rating/static/src/js/website_mail.js
parent55f93a240fcfa7d153435d7198632b8a2a50120e (diff)
[FIX] website_slides: fix some rating issues
Last review should be a comment. When fetching the last message on a course the returned message can be a system notification (like "Channel created"). This is not what we want, mostly with the feature allowing to modify the body of a message. This commit add restriction on the domain fetch last message. Fix default rating value on popup widget. The conversation ratio (rating 1-10 and 5 stars) was not applied everywhere. So, the number of displayed stars was doubled. This is now fixed. Commit linked to task ID 1941250 and PR #31317.
Diffstat (limited to 'addons/website_rating/static/src/js/website_mail.js')
-rw-r--r--addons/website_rating/static/src/js/website_mail.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/website_rating/static/src/js/website_mail.js b/addons/website_rating/static/src/js/website_mail.js
index 8f21f740c98..6fd9a305e95 100644
--- a/addons/website_rating/static/src/js/website_mail.js
+++ b/addons/website_rating/static/src/js/website_mail.js
@@ -33,6 +33,11 @@ odoo.define('website_rating.thread', function(require) {
init: function(parent, options){
this._super.apply(this, arguments);
+ // apply ratio to default rating value
+ if (options.default_rating_value) {
+ options.default_rating_value = parseFloat(options.default_rating_value) / STAR_RATING_RATIO;
+ }
+
// default options
this.options = _.defaults(this.options, {
'default_message': false,
@@ -50,7 +55,7 @@ odoo.define('website_rating.thread', function(require) {
'5': _t("I love it"),
};
this.user_click = false; // user has click or not
- this.set("star_value", this.options.rating_default_value);
+ this.set("star_value", this.options.default_rating_value);
this.on("change:star_value", this, this._onChangeStarValue);
},
start: function(){
@@ -59,7 +64,7 @@ odoo.define('website_rating.thread', function(require) {
// rating stars
self.$input = self.$('input[name="rating_value"]');
self.$star_list = self.$('.stars').find('i');
- self.set("star_value", self.options.rating_default_value); // set the default value to trigger the display of star widget
+ self.set("star_value", self.options.default_rating_value); // set the default value to trigger the display of star widget
});
},
@@ -265,7 +270,7 @@ odoo.define('website_rating.thread', function(require) {
_onChangeRatingDomain: function(){
var domain = [];
if(this.get('rating_value')){
- domain = [['rating_value', '=', this.get('rating_value')]];
+ domain = [['rating_value', '=', this.get('rating_value') * STAR_RATING_RATIO]];
}
this._changeCurrentPage(1, domain);
},