-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add consistency to participation in /contest #1743
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1743 +/- ##
==========================================
- Coverage 46.16% 46.16% -0.01%
==========================================
Files 223 223
Lines 12658 12659 +1
==========================================
Hits 5844 5844
- Misses 6814 6815 +1
Continue to review full report at Codecov.
|
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.
Can you also create a PR to https://github.com/DMOJ/docs?
judge/views/api/api_v2.py
Outdated
@@ -536,17 +568,27 @@ def get_object_data(self, profile): | |||
contest__in=Contest.get_visible_contests(self.request.user), | |||
contest__end_time__lt=self._now, | |||
) | |||
.annotate( | |||
old_rating=Subquery(old_ratings_subquery.values('rating')[:1]), | |||
new_rating=Subquery(new_ratings_subquery.values('rating')[:1]), |
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.
Not sure if this gets optimized properly, but why not just use rating__rating
and rating__volatility
instead of a subquery here?
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.
That's true, could the same reasoning be applied to https://github.com/JoshuaTianYangLiu/online-judge/blob/api-consistency/judge/views/api/api_v2.py#L255?
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.
Yes
Also, perhaps we should hold off on this PR until #1751 . |
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.
LGTM, though please create a PR to https://github.com/DMOJ/docs/.
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.
LGTM. @int-y1 when you have time, could you take another look?
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.
i don't think this pr was tested
new_rating=F('rating_rating'), | ||
old_mean=Subquery(old_ratings_subquery.values('mean')[:1]), | ||
new_mean=F('rating_mean'), | ||
performance=F('rating_performance'), |
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.
should use rating__
this affects all occurrences of rating_rating
, rating_mean
, rating_performance
in this pr
'new_rating', | ||
'old_mean', | ||
'new_mean', | ||
'performance', |
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.
.only
doesn't apply to annotations (and this causes a 500)
TODOs
/contest
[ ] virtual_participation_number(Always 0)/participations
- [ ] solutions (Out of context if placed in api)/user
- [ ] user ? (Redundant)- [ ] solutions (Out of context)- [ ] virtual_participation_number (Always 0)Also, a fix needs to be implemented for #1742 or else the same error will propagate to these proposed changes and cause confusion
Perhaps increase mccc15s by a microsecond