Looking at start contributing, mostly in dev-experience, tests and other things. Found some red tests and noticed recent refactorings, here is a try to complete that.
Two bugs from the brand -> brand_emblem change: forked variants copy the base issue's brand emblems, and brand group issue counts are not decremented on issue delete. Fixes both, with tests (test_fork_variant_for_cover_no_reserve, test_delete_issue).
Being new to scheme and domain of gcd.
https://github.com/GrandComicsDatabase/gcd-django/pull/723
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@janderssonse pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
/gemini review
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@gemini-code-assist[bot] commented on this pull request.
This pull request refactors the codebase to replace the brand field with brand_emblem across models, tests, and fixtures, and updates the brand group tracking logic in _check_major_change. Feedback on the changes highlights an N+1 query issue and a potential bug with duplicate groups in the newly introduced brand_groups helper function, which could lead to incorrect cached counts. Using prefetch_related and a set is recommended to resolve these issues.
> + def brand_groups(issue_or_revision): + groups = [] + for emblem in issue_or_revision.brand_emblem.all(): + groups.extend(emblem.group.all()) + return groups
The current implementation of brand_groups has two issues:
emblem.group.all()). This can be optimized by using prefetch_related('group') on the brand_emblem relation.BrandGroup objects. This will cause the cached counts of the same brand group to be decremented or incremented multiple times in _adjust_parent_counts. Using a set to collect the groups resolves this issue.- def brand_groups(issue_or_revision):
- groups = []
- for emblem in issue_or_revision.brand_emblem.all():
- groups.extend(emblem.group.all())
- return groups
+ def brand_groups(issue_or_revision):
+ groups = set()
+ for emblem in issue_or_revision.brand_emblem.prefetch_related('group'):
+ groups.update(emblem.group.all())
+ return groups
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@jochengcd commented on this pull request.
> + def brand_groups(issue_or_revision): + groups = [] + for emblem in issue_or_revision.brand_emblem.all(): + groups.extend(emblem.group.all()) + return groups
the N+1 Query is more nice to have, we rarely have more than one or two emblems
the double counts appear more relevant
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@janderssonse pushed 2 commits.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@janderssonse commented on this pull request.
> + def brand_groups(issue_or_revision): + groups = [] + for emblem in issue_or_revision.brand_emblem.all(): + groups.extend(emblem.group.all()) + return groups
Thanks for looking, let's see if this is better, I have updated and rebased the PR ->> the double count is the issue, a group shared by two emblems gets adjusted twice in _adjust_parent_counts, so I used the set(). The same duplication hit active_issues() too, so that gets .distinct() now. (In a dev/toy/test branch I have another future relpath improvement possibly that generalizes this a bit, but will see, that is for the future possibly)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()