@@ -174,25 +174,25 @@ def handle_cumulative_vote(session, context, option, unlimited=False):
174
174
allowed_votes = option .poll .number_of_votes
175
175
176
176
# Upvote, but no votes left
177
- if not unlimited and action == CallbackResult .vote_yes and vote_count >= allowed_votes :
177
+ if not unlimited and action == CallbackResult .yes and vote_count >= allowed_votes :
178
178
respond_to_vote (session , 'No votes left!' , context , option .poll )
179
179
return False
180
180
181
181
# Early return if downvote on non existing vote
182
- if existing_vote is None and action == CallbackResult .vote_no :
182
+ if existing_vote is None and action == CallbackResult .no :
183
183
respond_to_vote (session , 'Cannot downvote this option.' , context , option .poll )
184
184
return False
185
185
186
186
if existing_vote :
187
187
# Add to an existing vote
188
- if action == CallbackResult .vote_yes :
188
+ if action == CallbackResult .yes :
189
189
existing_vote .vote_count += 1
190
190
session .commit ()
191
191
total_vote_count = allowed_votes - (vote_count + 1 )
192
192
respond_to_vote (session , f'Vote added!' , context , option .poll , total_vote_count , True )
193
193
194
194
# Remove from existing vote
195
- elif action == CallbackResult .vote_no :
195
+ elif action == CallbackResult .no :
196
196
existing_vote .vote_count -= 1
197
197
session .commit ()
198
198
total_vote_count = allowed_votes - (vote_count - 1 )
@@ -204,7 +204,7 @@ def handle_cumulative_vote(session, context, option, unlimited=False):
204
204
session .commit ()
205
205
206
206
# Add new vote
207
- elif existing_vote is None and action == CallbackResult .vote_yes :
207
+ elif existing_vote is None and action == CallbackResult .yes :
208
208
vote = Vote (context .user , option )
209
209
session .add (vote )
210
210
session .commit ()
0 commit comments