Skip to content

Commit

Permalink
Merge pull request #717 from NBISweden/hotfix/better-status
Browse files Browse the repository at this point in the history
Refactor status determination logic in get_yearly_reports function
  • Loading branch information
jhagberg authored Jan 4, 2025
2 parents 05658ce + 16dfe4b commit 501f8e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/utils/data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -2492,11 +2492,15 @@ def get_yearly_reports(round_id: int, genebank_id: int) -> List[Dict]:
status = "Aktiv genbank" # Default status
if form_data.get("endingGenbank", False):
status = "Vill avsluta genbank"
elif (
form_data.get("numberOfMalesWithCertificate", 0) == 0
or form_data.get("numberOfFemalesWithCertificate", 0) == 0
):
status = "Avslutad, men kvar som medlem"
else:
males = form_data.get("numberOfMalesWithCertificate", 0)
females = form_data.get("numberOfFemalesWithCertificate", 0)
if males == 0 and females == 0:
status = "Automatisk avslutad: Saknar djur med intyg"
elif males == 0:
status = "Automatisk avslutad: Saknar hane med intyg"
elif females == 0:
status = "Automatisk avslutad: Saknar hona med intyg"

# Format publish information based on allowPublication array
publish_info = "Nej, ingen publicering"
Expand Down

0 comments on commit 501f8e6

Please sign in to comment.