[Oi-commits] r1491 - trunk/forum
oi-commits at pardus.org.tr
oi-commits at pardus.org.tr
Wed Jun 18 17:33:20 EEST 2008
Author: jnmbk
Date: Wed Jun 18 17:33:20 2008
New Revision: 1491
Modified:
trunk/forum/views.py
Log:
fix display problem when there are no votes
Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py (original)
+++ trunk/forum/views.py Wed Jun 18 17:33:20 2008
@@ -177,7 +177,10 @@
poll_options = topic.poll.polloption_set.all()
total_vote_count = topic.poll.pollvote_set.count() * 1.0
for option in poll_options:
- option.percent = int(option.vote_count / total_vote_count * 100)
+ if total_vote_count < 1:
+ option.percent = 0
+ else:
+ option.percent = int(option.vote_count / total_vote_count * 100)
if option.percent < 80:
option.percent_out = True
except: #DoesNotExist
More information about the Oi-commits
mailing list