Skip to content

Commit

Permalink
ekirjasto-18 Show ISBN and error in import log
Browse files Browse the repository at this point in the history
  • Loading branch information
natlibfi-kaisa committed Oct 30, 2024
1 parent d8ab44f commit 7e3bbce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/opds_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,17 +1961,19 @@ def run_once(self, progress: TimestampData) -> TimestampData:
feeds = self._get_feeds()
total_imported = 0
total_failures = 0
failure_summary = []

for link, feed in feeds:
self.log.info("Importing next feed: %s", link)
imported_editions, failures = self.import_one_feed(feed)
total_imported += len(imported_editions)
total_failures += len(failures)
for failure_id, failure_details in failures.items():
failure_summary.append(f"ISBN: {failure_id}: {failure_details}")
self._db.commit()

achievements = "Items imported: %d. Failures: %d." % (
total_imported,
total_failures,
achievements = (
"Items imported: %d. Failures: %d.\nFailed IDs and details:\n%s"
% (total_imported, total_failures, "\n".join(failure_summary))
)

return TimestampData(achievements=achievements)

0 comments on commit 7e3bbce

Please sign in to comment.