diff options
author | 2022-10-28 02:26:10 +0400 | |
---|---|---|
committer | 2022-10-28 02:32:07 +0400 | |
commit | 3940e34b89b67f1d45076bb2645f701e40d3357a (patch) | |
tree | 91f0db0e7e427f8b27bfd9318d48fa16ff3decd6 /pydis_site/apps/content/utils.py | |
parent | Implicitly Close Client Using `with` (diff) |
Clarify Code Intentions
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'pydis_site/apps/content/utils.py')
-rw-r--r-- | pydis_site/apps/content/utils.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pydis_site/apps/content/utils.py b/pydis_site/apps/content/utils.py index 8c9ad036..c12893ef 100644 --- a/pydis_site/apps/content/utils.py +++ b/pydis_site/apps/content/utils.py @@ -175,19 +175,19 @@ def record_tags(tags: list[Tag]) -> None: Tag.objects.exclude(name__in=[tag.name for tag in tags]).delete() # Insert/update the tags - for tag in tags: + for new_tag in tags: try: - old_tag = Tag.objects.get(name=tag.name) + old_tag = Tag.objects.get(name=new_tag.name) except Tag.DoesNotExist: # The tag is not in the database yet, # pretend it's previous state is the current state - old_tag = tag + old_tag = new_tag - if old_tag.sha == tag.sha and old_tag.last_commit is not None: + if old_tag.sha == new_tag.sha and old_tag.last_commit is not None: # We still have an up-to-date commit entry - tag.last_commit = old_tag.last_commit + new_tag.last_commit = old_tag.last_commit - tag.save() + new_tag.save() # Drop old, unused commits Commit.objects.filter(tag__isnull=True).delete() |