Skip to content

Add last_submission attribute to Team #24

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

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/contestadmin/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ def process_contest_results():
team = Team.objects.get(contest_id=id)
team.questions_answered = row[3]
team.score = row[4]
team.last_submission = row[5]
team.save()
except:
logger.error(
Expand Down
3 changes: 2 additions & 1 deletion src/core/templates/core/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ <h5 class="mb-0">How does scoring work?</h5>
Teams are ranked by the number of questions they have solved. If multiple teams have answered the same
number
of questions, then they are ranked by a point system based on least total time to submit a correct solution
for the questions, as well as fewest attempts to get the correct solution.
for the questions, as well as fewest attempts to get the correct solution. If multiple teams have the same
number of questions solved and points, then they are ranked by time of their last submission.
</p>
<p>
You receive points when you successfully solve a problem, and the amount of points is based on how many
Expand Down
6 changes: 3 additions & 3 deletions src/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ def get_context_data(self, **kwargs):

# Aggregate upper division team and participant info
upper_teams_set = teams_set.filter(division=1).filter(faculty=False).exclude(num_members=0)
context['upper_teams'] = upper_teams_set.order_by('-questions_answered', 'score', 'name')
context['upper_teams'] = upper_teams_set.order_by('-questions_answered', 'score', 'last_submission', 'name')
context['num_upper_teams'] = upper_teams_set.count()
context['num_upper_participants'] = participants_set.filter(team__division=1).count()

# Aggregate lower division team and participant info
lower_teams_set = teams_set.filter(division=2).filter(faculty=False).exclude(num_members=0)
context['lower_teams'] = lower_teams_set.order_by('-questions_answered', 'score', 'name')
context['lower_teams'] = lower_teams_set.order_by('-questions_answered', 'score', 'last_submission', 'name')
context['num_lower_teams'] = lower_teams_set.count()
context['num_lower_participants'] = participants_set.filter(team__division=2).count()

# Aggregate faculty team and participant info
faculty_teams_set = teams_set.filter(faculty=True).exclude(num_members=0)
context['faculty_teams'] = faculty_teams_set.order_by('-questions_answered', 'score', 'name')
context['faculty_teams'] = faculty_teams_set.order_by('-questions_answered', 'score', 'last_submission', 'name')
context['num_faculty_teams'] = faculty_teams_set.count()
context['num_faculty_participants'] = participants_set.filter(team__faculty=True).count()

Expand Down
18 changes: 18 additions & 0 deletions src/register/migrations/0004_team_last_submission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.4 on 2025-02-01 15:56

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('register', '0003_team_faculty'),
]

operations = [
migrations.AddField(
model_name='team',
name='last_submission',
field=models.PositiveSmallIntegerField(default=0),
),
]
3 changes: 3 additions & 0 deletions src/register/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class Team(models.Model):

score (PositiveSmallIntegerField): the team's final DOMjudge score

last_submission (PositiveSmallIntegerField): the team's last submission time

num_members (PositiveSmallIntegerField): the number of users on the team

faculty (BooleanField): If True, the team contains at least one faculty member. Otherwise the team does not contain a faculty member.
Expand All @@ -43,6 +45,7 @@ class Team(models.Model):
contest_password = models.CharField(max_length=6, unique=True, blank=True, null=True)
questions_answered = models.PositiveSmallIntegerField(default=0)
score = models.PositiveSmallIntegerField(default=0)
last_submission = models.PositiveSmallIntegerField(default=0)
num_members = models.PositiveSmallIntegerField(default=0)
faculty = models.BooleanField(default=False)

Expand Down