Skip to content

Commit

Permalink
Added ficion/non-fiction field to excel export
Browse files Browse the repository at this point in the history
  • Loading branch information
natlibfi-psams committed Oct 18, 2024
1 parent 77111fc commit 00f0398
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/local_analytics_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def export_excel(self, _db, start, end, locations=None, library=None):
header = [
"Tekijä (aakkostus)",
"Nimeke",
"Fiktio",
"Tunniste",
"Tunnisteen tyyppi",
"Kirjasto",
Expand All @@ -108,6 +109,8 @@ def export_excel(self, _db, start, end, locations=None, library=None):
row.get("sort_author", ""),
# Nimeke
row.get("sort_title", ""),
# Fiktio
"fiktio" if row.get("fiction") else "ei-fiktio",
# Tunniste
row.get("identifier", ""),
# Tunnisteen tyyppi
Expand Down Expand Up @@ -385,6 +388,10 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
Identifier.type.label("identifier_type"),
Edition.sort_title,
Edition.sort_author,
case(
[(Work.fiction == True, True)],
else_=False,
).label("fiction"),
Work.id.label("work_id"),
Edition.publisher,
Edition.language,
Expand Down Expand Up @@ -505,6 +512,7 @@ def analytics_query_loan_statistics(self, start, end, locations=None, library=No
events.identifier_type,
events.sort_title,
events.sort_author,
events.fiction,
events.publisher,
events.language,
genres.label("genres"),
Expand Down

0 comments on commit 00f0398

Please sign in to comment.