-
Notifications
You must be signed in to change notification settings - Fork 42
Add contribution weight model and tests #2769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add contribution weight model and tests #2769
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
researchhub-backend/src/reputation/related_models/score.py
Lines 291 to 295 in 584b0bf
| score_change = cls( | |
| algorithm_version=ALGORITHM_VERSION, | |
| algorithm_variables=algorithm_variables, | |
| score_after_change=current_rep, | |
| score_change=score_value_change, |
Newly added field contribution_type is never set when creating a ScoreChange inside create_score_change_citations; the instance relies on the model default 'UPVOTE' for every citation update. This means every citation-related score change will be recorded as an upvote, making the new indexes and analytics by contribution type inaccurate and preventing downstream code from distinguishing citation events. Please assign the appropriate ContributionWeight constant when constructing the object (and backfill if needed).
researchhub-backend/src/reputation/related_models/score.py
Lines 342 to 346 in 584b0bf
| score_change = cls( | |
| algorithm_version=ALGORITHM_VERSION, | |
| algorithm_variables=algorithm_variables, | |
| score_after_change=current_rep, | |
| score_change=score_value_change, |
Similarly, create_score_change_votes does not provide a contribution_type when constructing ScoreChange, so every vote-driven change is persisted with the default 'UPVOTE' regardless of whether it was an upvote or downvote. Queries against contribution_type will therefore miscount votes and the new feature flag for tiered scoring cannot distinguish different contribution categories. Set an explicit type based on the vote action to keep the data trustworthy.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2769 +/- ##
==========================================
- Coverage 75.79% 75.74% -0.05%
==========================================
Files 522 529 +7
Lines 27779 28569 +790
==========================================
+ Hits 21054 21641 +587
- Misses 6725 6928 +203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…, fix override priority
…ED, PAPER_PUBLISHED
…zero/negative amounts
yattias
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitp19 code looks really good.
Practically speaking, I think we should save score in a score_v2 column to avoid potentially breaking existing functionality
0e7af97 to
528fa38
Compare
This reverts commit 528fa38.
|



Implements foundation for tiered reputation scoring system where different contribution types receive different reputation weights based on effort and complexity. Implements core RSC to REP conversion logic for funding-based reputation scoring .
Key changes:
Key Formulas (based on community feedback):