Fix a bug that wasn't recording ratings correctly
authorAlex Chan <alex@alexwlchan.net>
Sun, 2 Feb 2020 21:53:07 +0000 (21:53 +0000)
committerAlex Chan <alex@alexwlchan.net>
Sun, 2 Feb 2020 21:53:07 +0000 (21:53 +0000)
scripts/add_book.py

index 2f959c7..c31d723 100755 (executable)
@@ -90,7 +90,9 @@ def get_review_info():
     ]
 
     answers = inquirer.prompt(other_questions)
-    rating = int(["rating"].count("★"))
+
+    rating = int(answers["rating"].count("★"))
+    assert 1 <= rating <= 5
 
     return {"date_read": date_read, "rating": rating, "format": answers["format"], "did_not_finish": answers["did_you_finish"] == "no"}