Skip to content

Commit

Permalink
Merge pull request #66 from libris/feature/bibstat-29-treat-folkskolb…
Browse files Browse the repository at this point in the history
…ib-like-folkbib

Treat "folkskolbib" like "folkbib" when choosing report template
  • Loading branch information
andersju authored May 17, 2021
2 parents 1534d08 + 499fb83 commit be81d4b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libstat/services/report_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ def get_report(surveys, year):
if cached_report:
return cached_report
else:

library_types = [survey.library.library_type for survey in surveys]
only_folkbib = all(libtype == u"folkbib" for libtype in library_types)
only_folkbib_or_folkskolbib = all(libtype in [u"folkbib", u"folkskolbib"] for libtype in library_types)

# This should of course be updated when (and if) more report templates are added

# Different report templates are used depending on types of libraries included
if only_folkbib:
if only_folkbib_or_folkskolbib:
report_template = report_template_base_with_municipality_calculations()
elif len(surveys) > 1 and any(libtype == u"folkbib" for libtype in library_types):
elif len(surveys) > 1 and any(libtype in [u"folkbib", u"folkskolbib"] for libtype in library_types):
report_template = report_template_base()
else:
report_template = report_template_base_with_target_group_calculations()
Expand Down

0 comments on commit be81d4b

Please sign in to comment.