mirror of
https://github.com/Xevion/contest-assistant.git
synced 2025-12-07 07:14:40 -06:00
overhaul voting to support smart single voting protections and enforcing, new exceptions, vote clearing functions inside models, persistence updating
This commit is contained in:
@@ -1,3 +1,32 @@
|
||||
class FinishedPeriod(Exception):
|
||||
"""A inactive period, or a period in it's final state cannot be advanced or further modified."""
|
||||
class ContestException(Exception):
|
||||
"""A exception directly related to the Contest Assistant bot."""
|
||||
pass
|
||||
|
||||
|
||||
class FinishedPeriodException(ContestException):
|
||||
"""A inactive period, or a period in it's final state cannot be advanced or further modified."""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return 'Period is inactive.'
|
||||
|
||||
|
||||
class DatabaseDoubleVoteException(ContestException):
|
||||
"""
|
||||
The database was asked to increment a vote for a submission with a user ID that was already added.
|
||||
|
||||
Companion to `DatabaseNoVoteException`
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return 'You can\'t vote for a submission twice.'
|
||||
|
||||
|
||||
class DatabaseNoVoteException(ContestException):
|
||||
"""
|
||||
The database was asked to decrement a vote for a submission with a user ID that did not or no longer exists for the given submission.
|
||||
|
||||
Companion to `DatabaseDoubleVoteException`
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return 'You can\'t remove a vote that never or no longer exists'
|
||||
|
||||
Reference in New Issue
Block a user