[244] Add Weighted Rating Calculation#304
Merged
Naomi-Gift merged 3 commits intoJul 2, 2026
Merged
Conversation
Preserve prior review revisions with ordered storage, revision count, history getters, revision events, and tests while restoring the full contract interface broken on main. Closes HubDApp#239 Co-authored-by: Cursor <cursoragent@cursor.com>
Implement O(1) weighted rating from aggregate stats using a documented prior formula while preserving the existing average rating getter. Closes HubDApp#244 Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Goodnessukaigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_weighted_ratingusing O(1) aggregate statsRatingCalculator::calculate_weightedaverage_rating/get_project_statsbehavior unchangedCloses #244
Weighted rating formula
C=WEIGHTED_RATING_PRIOR_COUNT(5)m=WEIGHTED_RATING_PRIOR_MEAN(350 = 3.50 stars)rating_sumuses the existing scaled aggregate (rating * 100)Edge cases: zero reviews → prior mean; single review → blended score; large datasets → converges to arithmetic mean.
Tests executed
cargo fmtcargo clippy --all-targets --all-features -- -D warningscargo test --workspace(502 tests)Backward compatibility
Note: This PR builds on the contract restoration in #239; merge #239 first or expect overlap in shared files.
Made with Cursor