Skip to content

Update IG count calculation and add karma breakdown to profiles#3073

Merged
DevWithPranav merged 4 commits into
dev-serverfrom
dev
Jul 23, 2026
Merged

Update IG count calculation and add karma breakdown to profiles#3073
DevWithPranav merged 4 commits into
dev-serverfrom
dev

Conversation

@DevWithPranav

Copy link
Copy Markdown
Collaborator

No description provided.

@DevWithPranav
DevWithPranav merged commit bf44400 into dev-server Jul 23, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Triage to QA in µLearn Delivery Jul 23, 2026
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates campus IG counts and adds detailed karma attribution to user profiles. The main changes are:

  • Count active IGs from campus chapter records.
  • Split approved karma into general, intern, IG, and event categories.
  • Include organizing IG metadata in event karma entries.
  • Expose four new karma fields in profile responses.

Confidence Score: 4/5

The changed counting and karma-classification paths can return inconsistent data and should be fixed before merging.

  • Duplicate chapter rows can inflate active_ig_count.
  • Intern Lead tasks are classified differently by two fields in the same profile response.
  • No security or module-loading issue was identified in the changed code.

api/dashboard/campus/serializers.py; api/dashboard/profile/profile_serializer.py

Important Files Changed

Filename Overview
api/dashboard/campus/serializers.py Changes active IG counting to use campus chapter rows, but duplicate rows can inflate the result.
api/dashboard/profile/profile_serializer.py Adds profile karma breakdowns, with inconsistent classification of tasks created by Intern Leads.

Reviews (1): Last reviewed commit: "Merge pull request #3072 from DevWithPra..." | Re-trigger Greptile

Comment on lines +254 to +257
return CampusIGChapter.objects.filter(
org=obj.org,
is_active=True,
).count()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Duplicate Chapters Inflate Count

When an organization has multiple active CampusIGChapter rows for the same IG, this returns the number of rows rather than the number of active IGs. The model has no uniqueness constraint for (org, ig), so callers can receive an inflated active_ig_count; the previous implementation explicitly counted distinct IGs.

Suggested change
return CampusIGChapter.objects.filter(
org=obj.org,
is_active=True,
).count()
return (
CampusIGChapter.objects.filter(
org=obj.org,
is_active=True,
)
.values("ig_id")
.distinct()
.count()
)

Comment on lines +78 to +81
When(
Q(task__hashtag__startswith="#intern-") | Q(is_intern_creator=True),
then=Value("intern"),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Intern Lead Buckets Disagree

For a general task created by an active Intern Lead, with no event, IG, or #intern- hashtag, this new calculation reports the karma as intern_karma. The existing karma_distribution calculation recognizes only RoleType.INTERN, so the same profile response classifies that karma as general or other and clients cannot reconcile its breakdown fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: QA

Development

Successfully merging this pull request may close these issues.

2 participants