Fix contest summary
This commit is contained in:
parent
1dd4ccd324
commit
9c01ec8a22
2 changed files with 4 additions and 4 deletions
|
@ -559,5 +559,5 @@ class ContestsSummaryAdmin(admin.ModelAdmin):
|
|||
def save_model(self, request, obj, form, change):
|
||||
super(ContestsSummaryAdmin, self).save_model(request, obj, form, change)
|
||||
obj.refresh_from_db()
|
||||
obj.results = recalculate_contest_summary_result(obj)
|
||||
obj.results = recalculate_contest_summary_result(request, obj)
|
||||
obj.save()
|
||||
|
|
|
@ -1555,7 +1555,7 @@ class ContestsSummaryView(DiggPaginatorMixin, ListView):
|
|||
return context
|
||||
|
||||
|
||||
def recalculate_contest_summary_result(contest_summary):
|
||||
def recalculate_contest_summary_result(request, contest_summary):
|
||||
scores_system = contest_summary.scores
|
||||
contests = contest_summary.contests.all()
|
||||
total_points = defaultdict(int)
|
||||
|
@ -1564,14 +1564,14 @@ def recalculate_contest_summary_result(contest_summary):
|
|||
|
||||
for i in range(len(contests)):
|
||||
contest = contests[i]
|
||||
users, problems = get_contest_ranking_list(None, contest)
|
||||
users, problems = get_contest_ranking_list(request, contest)
|
||||
for rank, user in users:
|
||||
curr_score = 0
|
||||
if rank - 1 < len(scores_system):
|
||||
curr_score = scores_system[rank - 1]
|
||||
total_points[user.user] += curr_score
|
||||
result_per_contest[user.user][i] = (curr_score, rank)
|
||||
user_css_class[user.user] = user.css_class
|
||||
user_css_class[user.user] = user.user.css_class
|
||||
|
||||
sorted_total_points = [
|
||||
ContestsSummaryData(
|
||||
|
|
Loading…
Reference in a new issue