Skip to content

Commit

Permalink
Merge pull request #106 from NatLibFi/EKIRJASTO-22-include-audience-i…
Browse files Browse the repository at this point in the history
…n-report

Ekirjasto 22 include audience in report
  • Loading branch information
natlibfi-kaisa authored Oct 30, 2024
2 parents 82057e8 + ef6fc98 commit d8ab44f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/local_analytics_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def export_excel(self, _db, start, end, locations=None, library=None):
"Sijainti",
"Formaatti",
"Kategoria(t)",
"Kohderyhmä",
"Kieli",
"Kustantaja/Julkaisija",
"Kaikki lainat",
Expand Down Expand Up @@ -123,6 +124,8 @@ def export_excel(self, _db, start, end, locations=None, library=None):
row.get("medium", ""),
# Kategoria(t)
categories,
# Kohderyhmä
row.get("audience", ""),
# Kieli
row.get("language", ""),
# Kustantaja/Julkaisija
Expand Down Expand Up @@ -392,6 +395,7 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
[(Work.fiction == True, True)],
else_=False,
).label("fiction"),
Work.audience,
Work.id.label("work_id"),
Edition.publisher,
Edition.language,
Expand Down Expand Up @@ -516,6 +520,7 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
events.publisher,
events.language,
genres.label("genres"),
events.audience,
contributors.label("contributors"),
events.location,
events.library_name,
Expand Down
3 changes: 3 additions & 0 deletions tests/api/finland/test_loan_excel_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"publisher": "Standard Ebooks",
"language": "eng",
"genres": ["General Fiction"],
"audience": "adults",
"contributors": ["Eliot, George (Author)", "Fake contributor (Author)"],
"location": None,
"library_name": "Open Access Library",
Expand All @@ -45,6 +46,7 @@
"publisher": "Standard Ebooks",
"language": "eng",
"genres": ["Philosophy"],
"audience": "adults",
"contributors": ["Russell, Bertrand (Author)"],
"location": None,
"library_name": "Open Access Library",
Expand Down Expand Up @@ -83,6 +85,7 @@ def test_export_excel(self):
"Sijainti",
"Formaatti",
"Kategoria(t)",
"Kohderyhmä",
"Kieli",
"Kustantaja/Julkaisija",
"Kaikki lainat",
Expand Down

0 comments on commit d8ab44f

Please sign in to comment.