mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 18:00:45 +01:00
Merge pull request #839 from Benbb96/fix-kb-item-score
Fix KnowledgeBase item score to display as float
This commit is contained in:
commit
8541e03b88
@ -1031,8 +1031,9 @@ class KBItem(models.Model):
|
||||
return super(KBItem, self).save(*args, **kwargs)
|
||||
|
||||
def _score(self):
|
||||
""" Return a score out of 10 or Unrated if no votes """
|
||||
if self.votes > 0:
|
||||
return int(self.recommendations / self.votes)
|
||||
return (self.recommendations / self.votes) * 10
|
||||
else:
|
||||
return _('Unrated')
|
||||
score = property(_score)
|
||||
|
@ -29,7 +29,7 @@
|
||||
<ul>
|
||||
<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.score as score %}Overall Rating: {{ score }}{% endblocktrans %}</li>
|
||||
<li>{% blocktrans with item.score|floatformat as score %}Overall Rating: {{ score }}{% endblocktrans %}/10</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user