Optimize contest ranked submission (DMOJ)
This commit is contained in:
parent
8a6288f8e6
commit
d5b21935ae
2 changed files with 6 additions and 5 deletions
|
@ -17,10 +17,9 @@ class RankedSubmissions(ProblemSubmissions):
|
|||
|
||||
def get_queryset(self):
|
||||
if self.in_contest:
|
||||
contest_join = """INNER JOIN judge_contestsubmission AS cs ON (sub.id = cs.submission_id)
|
||||
INNER JOIN judge_contestparticipation AS cp ON (cs.participation_id = cp.id)"""
|
||||
contest_join = "INNER JOIN judge_contestsubmission AS cs ON (sub.id = cs.submission_id)"
|
||||
points = "cs.points"
|
||||
constraint = "AND cp.contest_id = %s"
|
||||
constraint = " AND sub.contest_object_id = %s"
|
||||
else:
|
||||
contest_join = ""
|
||||
points = "sub.points"
|
||||
|
@ -46,8 +45,8 @@ class RankedSubmissions(ProblemSubmissions):
|
|||
GROUP BY sub.user_id, {points}
|
||||
) AS fastest ON (highscore.uid = fastest.uid AND highscore.points = fastest.points)
|
||||
STRAIGHT_JOIN judge_submission AS sub
|
||||
ON (sub.user_id = fastest.uid AND sub.time = fastest.time) {contest_join}
|
||||
WHERE sub.problem_id = %s AND {points} > 0 {constraint}
|
||||
ON (sub.user_id = fastest.uid AND sub.time = fastest.time)
|
||||
WHERE sub.problem_id = %s {constraint}
|
||||
GROUP BY sub.user_id
|
||||
""".format(
|
||||
points=points, contest_join=contest_join, constraint=constraint
|
||||
|
|
|
@ -135,6 +135,8 @@
|
|||
</div>
|
||||
<hr>
|
||||
{% endif %}
|
||||
<div style="clear: both"></div>
|
||||
<br>
|
||||
{% include "actionbar/list.html" %}
|
||||
<br>
|
||||
{% include "comments/list.html" %}
|
||||
|
|
Loading…
Reference in a new issue