Skip to content

Commit

Permalink
Move the sum to the left in the ranking page (sio2project#115)
Browse files Browse the repository at this point in the history
* Move the sum to the left in the ranking page

* Remove obsolete logic from Mistrz Programowania

* Make the sum column's background gray in rankings
  • Loading branch information
otargowski authored Aug 28, 2024
1 parent 89faa8b commit 33514f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 62 deletions.
9 changes: 2 additions & 7 deletions oioioi/mp/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def can_submit(self, request, problem_instance, check_round_times=True):

class MPRankingController(DefaultRankingController):
"""Changes to Default Ranking:
1. Sum column is just after User column
2. Rounds with earlier start_date are more to the left
1. Rounds with earlier start_date are more to the left.
2. Users with 0 points aren't listed.
"""

description = _("MP style ranking")
Expand All @@ -212,10 +212,5 @@ def _iter_rounds(self, can_see_all, timestamp, partial_key, request=None):
def _filter_pis_for_ranking(self, partial_key, queryset):
return queryset.order_by("-round__start_date")

def _render_ranking_page(self, key, data, page):
request = self._fake_request(page)
data['is_admin'] = self.is_admin_key(key)
return render_to_string('mp/ranking.html', context=data, request=request)

def _allow_zero_score(self):
return False
53 changes: 0 additions & 53 deletions oioioi/mp/templates/mp/ranking.html

This file was deleted.

3 changes: 3 additions & 0 deletions oioioi/rankings/static/common/rankings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ $ranking-cell-width: 100px !default;
@include text-overflow();
max-width: $table-ranking-max-username-width;
}
.sum-cell {
background-color: #e9e9e9;
}
}

.outdated-ranking-msg-float {
Expand Down
4 changes: 2 additions & 2 deletions oioioi/rankings/templates/rankings/default_ranking.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<tr>
<th class="text-right">#</th>
<th>{% trans "User" %}</th>
<th class="text-right">{% trans "Sum" %}</th>
{% for pi, statement_visible in problem_instances %}
{% if statement_visible %}
{% url 'problem_statement' contest_id=contest.id problem_instance=pi.short_name as link %}
Expand All @@ -19,14 +20,14 @@
{% if statement_visible %}</a>{% endif %}
</th>
{% endfor %}
<th class="text-right">{% trans "Sum" %}</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr id="ranking_row_{{ row.user.id }}" class="{% block row-classes %}{% endblock %}">
<td class="text-right">{{ row.place }}</td>
<td class="user-cell">{% public_name row.user %}</td>
<td class="text-right sum-cell">{{ row.sum }}</td>
{% for result in row.results %}
<td class="text-right{% if result.problem_instance.round.is_trial %} trial-round
{% else %} {{ result.score|result_color_class }}{% endif %}">
Expand All @@ -36,7 +37,6 @@
</span>
</td>
{% endfor %}
<td class="text-right">{{ row.sum }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit 33514f0

Please sign in to comment.