Skip to content

Commit

Permalink
Prevents tags from being counted more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
diegogangl committed Feb 19, 2024
1 parent 8933cd0 commit dd4d140
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions GTG/core/tasks2.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,16 @@ def add_tag(self, tag: Tag2) -> None:
"""Add a tag to this task."""

if isinstance(tag, Tag2):
self.tags.add(tag)
if tag not in self.tags:
self.tags.add(tag)

if self.status == Status.ACTIVE:
tag.task_count_open += 1
else:
tag.task_count_closed += 1

if self.is_actionable:
tag.task_count_actionable += 1
if self.status == Status.ACTIVE:
tag.task_count_open += 1
else:
tag.task_count_closed += 1
if self.is_actionable:
tag.task_count_actionable += 1
else:
raise ValueError

Expand Down

0 comments on commit dd4d140

Please sign in to comment.