Skip to content

Commit d8ab44f

Browse files
Merge pull request #106 from NatLibFi/EKIRJASTO-22-include-audience-in-report
Ekirjasto 22 include audience in report
2 parents 82057e8 + ef6fc98 commit d8ab44f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

api/local_analytics_exporter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def export_excel(self, _db, start, end, locations=None, library=None):
8989
"Sijainti",
9090
"Formaatti",
9191
"Kategoria(t)",
92+
"Kohderyhmä",
9293
"Kieli",
9394
"Kustantaja/Julkaisija",
9495
"Kaikki lainat",
@@ -123,6 +124,8 @@ def export_excel(self, _db, start, end, locations=None, library=None):
123124
row.get("medium", ""),
124125
# Kategoria(t)
125126
categories,
127+
# Kohderyhmä
128+
row.get("audience", ""),
126129
# Kieli
127130
row.get("language", ""),
128131
# Kustantaja/Julkaisija
@@ -392,6 +395,7 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
392395
[(Work.fiction == True, True)],
393396
else_=False,
394397
).label("fiction"),
398+
Work.audience,
395399
Work.id.label("work_id"),
396400
Edition.publisher,
397401
Edition.language,
@@ -516,6 +520,7 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
516520
events.publisher,
517521
events.language,
518522
genres.label("genres"),
523+
events.audience,
519524
contributors.label("contributors"),
520525
events.location,
521526
events.library_name,

tests/api/finland/test_loan_excel_export.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"publisher": "Standard Ebooks",
3131
"language": "eng",
3232
"genres": ["General Fiction"],
33+
"audience": "adults",
3334
"contributors": ["Eliot, George (Author)", "Fake contributor (Author)"],
3435
"location": None,
3536
"library_name": "Open Access Library",
@@ -45,6 +46,7 @@
4546
"publisher": "Standard Ebooks",
4647
"language": "eng",
4748
"genres": ["Philosophy"],
49+
"audience": "adults",
4850
"contributors": ["Russell, Bertrand (Author)"],
4951
"location": None,
5052
"library_name": "Open Access Library",
@@ -83,6 +85,7 @@ def test_export_excel(self):
8385
"Sijainti",
8486
"Formaatti",
8587
"Kategoria(t)",
88+
"Kohderyhmä",
8689
"Kieli",
8790
"Kustantaja/Julkaisija",
8891
"Kaikki lainat",

0 commit comments

Comments
 (0)