fix: error message restricted election

dependabot/pip/requests-2.31.0
Pierre-Louis Guhur 1 year ago committed by guhur
parent 091e70cdb0
commit b12b7c7790

@ -445,6 +445,9 @@ def get_results(db: Session, election_ref: str) -> schemas.ResultsGet:
if db_election is None:
raise errors.NotFoundError("elections")
if db_election.hide_results and (db_election.date_end > datetime.now()):
raise errors.ForbiddenError("The election is not closed")
query = db.query(
models.Vote.candidate_id, models.Grade.value, func.count(models.Vote.id)
)

Loading…
Cancel
Save