Skip to content

Commit

Permalink
Add check for stories without any chapters.
Browse files Browse the repository at this point in the history
Thanks, @minjonet, for the idea!
  • Loading branch information
hlieberman committed Mar 17, 2024
1 parent dd5b73c commit bd5da62
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 08-Check-ODAP-Tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,24 @@
log.error("Found at least one bad author email; ending audit here.")
sys.exit(7)

##
## Check for stories without chapters
##

log.debug("Checking for stories without any chapters.")
found_error = False

empty_stories = sql.execute_dict(
"SELECT s.id as sid FROM stories s LEFT JOIN chapters c ON c.story_id = s.id WHERE c.story_id IS NULL"
)

if empty_stories:
found_error = True
for story in empty_stories:
log.error(f"Found story with no chapters: {story['sid']}")

if found_error:
log.error("Found at least one story with no chapters; ending audit here.")
sys.exit(8)

log.info("All checks completed successfully.")

0 comments on commit bd5da62

Please sign in to comment.