mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-29 03:13:15 +01:00
Fix KnowledgeBase item score
This commit is contained in:
parent
630cfd9179
commit
d961b2b692
@ -1031,8 +1031,9 @@ class KBItem(models.Model):
|
|||||||
return super(KBItem, self).save(*args, **kwargs)
|
return super(KBItem, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def _score(self):
|
def _score(self):
|
||||||
|
""" Return a score out of 10 or Unrated if no votes """
|
||||||
if self.votes > 0:
|
if self.votes > 0:
|
||||||
return int(self.recommendations / self.votes)
|
return (self.recommendations / self.votes) * 10
|
||||||
else:
|
else:
|
||||||
return _('Unrated')
|
return _('Unrated')
|
||||||
score = property(_score)
|
score = property(_score)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>{% blocktrans with item.recommendations as recommendations %}Recommendations: {{ recommendations }}{% endblocktrans %}</li>
|
<li>{% blocktrans with item.recommendations as recommendations %}Recommendations: {{ recommendations }}{% endblocktrans %}</li>
|
||||||
<li>{% blocktrans with item.votes as votes %}Votes: {{ votes }}{% endblocktrans %}</li>
|
<li>{% blocktrans with item.votes as votes %}Votes: {{ votes }}{% endblocktrans %}</li>
|
||||||
<li>{% blocktrans with item.score as score %}Overall Rating: {{ score }}{% endblocktrans %}</li>
|
<li>{% blocktrans with item.score|floatformat as score %}Overall Rating: {{ score }}{% endblocktrans %}/10</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user