Handles the situation where no posts exist #77

Merged
cmccabe merged 1 commits from handle-empty-database into master 2020-01-16 03:28:33 +00:00
Collaborator

Fixes #76

  • Check if link_data is empty when adding a new link, to ensure a post ID is always generated correctly in this situation
  • Check if there are no categories to print out, and print an appropriate message if there are no categories (because there's no posts)
  • Tests added to cover issue #76
  • Ran formatter (black) on all files

Tested on my system as well as rawtext.club, using unit tests as well as by adding a new post.

Fixes #76 - Check if link_data is empty when adding a new link, to ensure a post ID is always generated correctly in this situation - Check if there are no categories to print out, and print an appropriate message if there are no categories (because there's no posts) - Tests added to cover issue #76 - Ran formatter (black) on all files Tested on my system as well as rawtext.club, using unit tests as well as by adding a new post.
asdf added the
bug
enhancement
this release
labels 2020-01-16 03:26:57 +00:00
cmccabe closed this pull request 2020-01-16 03:28:32 +00:00
sloum approved these changes 2020-01-16 16:59:17 +00:00
sloum left a comment
Collaborator

This looks like a sensible solution to me. Good job on the test coverage.

This looks like a sensible solution to me. Good job on the test coverage.
@ -159,3 +159,3 @@
new_post_id = -1
if record.category:
new_post_id = max([record[0] for record in self.link_data if record[0]]) + 1
if self.link_data:
Collaborator

Solid.

Solid.
asdf deleted branch handle-empty-database 2020-01-16 23:32:23 +00:00
Sign in to join this conversation.
No description provided.