Skip to content

Commit

Permalink
push_info cannot be called from its parent django app, so let us fall…
Browse files Browse the repository at this point in the history
…back on exceptions
  • Loading branch information
why-not-try-calmer committed Nov 14, 2023
1 parent 3ececaa commit 6515f2c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions comptages/core/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from datetime import timedelta, datetime
from openpyxl import load_workbook
from comptages.core.utils import push_info

from comptages.datamodel import models
from comptages.core import statistics
Expand Down Expand Up @@ -69,11 +68,10 @@ def _prepare_yearly_report(file_path, year, template_path, section_id, callback_
count_nb = count_qs.count()

if count_nb < lower_bound:
push_info(f"""
Only {count_nb} Count objects were found! Please add {lower_bound - count_nb} objects before retrying.
No report will be generated until then.
raise ValueError(f"""
Only {count_nb} Count objects were found! Please add {lower_bound - count_nb} objects before retrying.
No report will be generated until then.
""")
return
count = count_qs[0]

workbook = load_workbook(filename=template_path)
Expand Down

0 comments on commit 6515f2c

Please sign in to comment.