summaryrefslogtreecommitdiff
path: root/addons/gamification
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-10-18 15:17:41 +0000
committerThibault Delavallée <tde@odoo.com>2019-11-22 14:44:39 +0000
commit6f0d36fa67c91d0bd70cf092bd1d41c615e1e8be (patch)
tree8f92e2db08d551021a2003908dc111b4411d67c9 /addons/gamification
parente85faf398659a5beb0b1570a06af64dcf78dc1c8 (diff)
[REF] gamification : rename stat_* fields into granted_* to ease understanding
In this commit we rename stat_count into granted_count, and stat_count_distinct into granted_users_count to reflect more what are those variables, aka count of granted badges. Task ID: 1961053 PR #32594
Diffstat (limited to 'addons/gamification')
-rw-r--r--addons/gamification/models/badge.py16
-rw-r--r--addons/gamification/views/badge.xml10
2 files changed, 13 insertions, 13 deletions
diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py
index bd270113a52..7bfdd074644 100644
--- a/addons/gamification/models/badge.py
+++ b/addons/gamification/models/badge.py
@@ -107,8 +107,8 @@ class GamificationBadge(models.Model):
'gamification.badge.user', 'badge_id',
string='Owners', help='The list of instances of this badge granted to users')
- stat_count = fields.Integer("Total", compute='_get_owners_info', help="The number of time this badge has been received.")
- stat_count_distinct = fields.Integer("Number of users", compute='_get_owners_info', help="The number of time this badge has been received by unique users.")
+ granted_count = fields.Integer("Total", compute='_get_owners_info', help="The number of time this badge has been received.")
+ granted_users_count = fields.Integer("Number of users", compute='_get_owners_info', help="The number of time this badge has been received by unique users.")
unique_owner_ids = fields.Many2many(
'res.users', string="Unique Owners", compute='_get_owners_info',
help="The list of unique users having received this badge.")
@@ -139,8 +139,8 @@ class GamificationBadge(models.Model):
the total number of users this badge was granted to
"""
self.env.cr.execute("""
- SELECT badge_id, count(user_id) as stat_count,
- count(distinct(user_id)) as stat_count_distinct,
+ SELECT badge_id, count(user_id) as granted_count,
+ count(distinct(user_id)) as granted_users_count,
array_agg(distinct(user_id)) as unique_owner_ids
FROM gamification_badge_user
WHERE badge_id in %s
@@ -148,14 +148,14 @@ class GamificationBadge(models.Model):
""", [tuple(self.ids)])
defaults = {
- 'stat_count': 0,
- 'stat_count_distinct': 0,
+ 'granted_count': 0,
+ 'granted_users_count': 0,
'unique_owner_ids': [],
}
mapping = {
badge_id: {
- 'stat_count': count,
- 'stat_count_distinct': distinct_count,
+ 'granted_count': count,
+ 'granted_users_count': distinct_count,
'unique_owner_ids': owner_ids,
}
for (badge_id, count, distinct_count, owner_ids) in self.env.cr._obj
diff --git a/addons/gamification/views/badge.xml b/addons/gamification/views/badge.xml
index 5dc93d1f921..1115729191f 100644
--- a/addons/gamification/views/badge.xml
+++ b/addons/gamification/views/badge.xml
@@ -35,7 +35,7 @@
<field name="arch" type="xml">
<tree string="Badge List">
<field name="name"/>
- <field name="stat_count"/>
+ <field name="granted_count"/>
<field name="stat_this_month"/>
<field name="stat_my"/>
<field name="rule_auth"/>
@@ -93,9 +93,9 @@
</group>
<group string="Statistics">
<group>
- <field name="stat_count"/>
+ <field name="granted_count"/>
<field name="stat_this_month"/>
- <field name="stat_count_distinct"/>
+ <field name="granted_users_count"/>
</group>
<group>
<field name="stat_my"/>
@@ -117,7 +117,7 @@
<field name="name"/>
<field name="description"/>
<field name="stat_my"/>
- <field name="stat_count"/>
+ <field name="granted_count"/>
<field name="stat_this_month"/>
<field name="unique_owner_ids"/>
<field name="stat_my_monthly_sending"/>
@@ -141,7 +141,7 @@
</span>
<div t-if="record.remaining_sending.value == 0" class="oe_grey">Can not grant</div>
<div>
- <strong><t t-esc="record.stat_count.raw_value"/></strong> granted,
+ <strong><t t-esc="record.granted_count.raw_value"/></strong> granted,
<strong><t t-esc="record.stat_this_month.raw_value"/></strong> this month
</div>
<div t-if="record.description.value" class="o_kanban_badge_description">