Skip to content

Commit 7340436

Browse files
authored
Add check for stories without any chapters. (#81)
1 parent df910b3 commit 7340436

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

08-Check-ODAP-Tables.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,24 @@
211211
log.error("Found at least one bad author email; ending audit here.")
212212
sys.exit(7)
213213

214+
##
215+
## Check for stories without chapters
216+
##
217+
218+
log.debug("Checking for stories without any chapters.")
219+
found_error = False
220+
221+
empty_stories = sql.execute_dict(
222+
"SELECT s.id as sid FROM stories s LEFT JOIN chapters c ON c.story_id = s.id WHERE c.story_id IS NULL"
223+
)
224+
225+
if empty_stories:
226+
found_error = True
227+
for story in empty_stories:
228+
log.error(f"Found story with no chapters: {story['sid']}")
229+
230+
if found_error:
231+
log.error("Found at least one story with no chapters; ending audit here.")
232+
sys.exit(8)
233+
214234
log.info("All checks completed successfully.")

0 commit comments

Comments
 (0)