Skip to content

Commit

Permalink
Merge pull request #487 from GeraldJansen/tag-deletion
Browse files Browse the repository at this point in the history
fix bug preventing removal of autocompletion tags
  • Loading branch information
ederag authored Dec 20, 2019
2 parents 58a1425 + 28105ff commit 4f7746b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hamster/storage/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __get_tag_ids(self, tags):
changes = False

# check if any of tags needs resurrection
set_complete = [str(tag["id"]) for tag in db_tags if tag["autocomplete"] == "false"]
set_complete = [str(tag["id"]) for tag in db_tags if tag["autocomplete"] in (0, "false")]
if set_complete:
changes = True
self.execute("update tags set autocomplete='true' where id in (%s)" % ", ".join(set_complete))
Expand Down Expand Up @@ -206,7 +206,8 @@ def __update_autocomplete_tags(self, tags):
gone = self.fetchall(query, tags)

to_delete = [str(tag["id"]) for tag in gone if tag["occurences"] == 0]
to_uncomplete = [str(tag["id"]) for tag in gone if tag["occurences"] > 0 and tag["autocomplete"] == "true"]
to_uncomplete = [str(tag["id"]) for tag in gone
if tag["occurences"] > 0 and tag["autocomplete"] in (1, "true")]

if to_delete:
self.execute("delete from tags where id in (%s)" % ", ".join(to_delete))
Expand Down

0 comments on commit 4f7746b

Please sign in to comment.