1. Puria Nafisi Azizi
  2. tgapp-tgpolls

Commits

Puria Nafisi Azizi  committed 8961052

Added total votes

  • Participants
  • Parent commits 8beada4
  • Branches default

Comments (0)

Files changed (1)

File tgpolls/model/models.py

View file
     def expired(self):
         return (self.expiry < datetime.datetime.now())
 
+    @property
+    def total_votes(self):
+        return sum([vote.votes for vote in self.answers])
+
 
 class PollAnswer(DeclarativeBase):
     __tablename__ = 'tgpolls_poll_answers'