display results of polls closed when reaching end_date, and polls where the current user cannot vote

This commit is contained in:
Manuel Cortez 2019-03-07 15:23:37 -06:00
parent 0b9dcaa8f1
commit a13a4a5695
2 changed files with 2 additions and 2 deletions

View File

@ -657,7 +657,7 @@ class displayPollPresenter(base.basePresenter):
title = _("Poll from {user1_nom}").format(**user)
self.send_message("set_title", value=title)
self.send_message("set", control="question", value=self.poll["question"])
if len(self.poll["answer_ids"]) > 0 or ("is_closed" in self.poll and self.poll["is_closed"] == True) or load_results == True:
if len(self.poll["answer_ids"]) > 0 or ("is_closed" in self.poll and self.poll["is_closed"] == True) or load_results == True or ("can_vote" in self.poll and self.poll["can_vote"] == False):
options = []
for i in self.poll["answers"]:
options.append((i["text"], i["votes"], i["rate"]))

View File

@ -345,7 +345,7 @@ class displayPoll(widgetUtils.BaseDialog):
for i in options:
sizer2 = wx.StaticBoxSizer(parent=sizer.GetStaticBox(), orient=wx.HORIZONTAL, label=i[0])
staticcontrol = wx.StaticText(sizer2.GetStaticBox(), wx.NewId(), i[0])
control = wx.TextCtrl(sizer2.GetStaticBox(), wx.NewId(), _("{votes} votes ({rate}% rate)").format(votes=i[1], rate=i[2]), style=wx.TE_READONLY|wx.TE_MULTILINE)
control = wx.TextCtrl(sizer2.GetStaticBox(), wx.NewId(), _("{votes} ({rate}%)").format(votes=i[1], rate=i[2]), style=wx.TE_READONLY|wx.TE_MULTILINE)
sizer2.Add(staticcontrol, 0, wx.ALL, 5)
sizer2.Add(control, 0, wx.ALL, 5)
sizer.Add(sizer2, 0, wx.ALL, 5)