Skip to content

Commit 3e2bfe8

Browse files
Merge pull request #24 from FSU-ACM/issue-23
Add last_submission attribute to Team
2 parents d87b2a6 + 9edf41b commit 3e2bfe8

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

src/contestadmin/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ def process_contest_results():
378378
team = Team.objects.get(contest_id=id)
379379
team.questions_answered = row[3]
380380
team.score = row[4]
381+
team.last_submission = row[5]
381382
team.save()
382383
except:
383384
logger.error(

src/core/templates/core/faq.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ <h5 class="mb-0">How does scoring work?</h5>
228228
Teams are ranked by the number of questions they have solved. If multiple teams have answered the same
229229
number
230230
of questions, then they are ranked by a point system based on least total time to submit a correct solution
231-
for the questions, as well as fewest attempts to get the correct solution.
231+
for the questions, as well as fewest attempts to get the correct solution. If multiple teams have the same
232+
number of questions solved and points, then they are ranked by time of their last submission.
232233
</p>
233234
<p>
234235
You receive points when you successfully solve a problem, and the amount of points is based on how many

src/core/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,19 @@ def get_context_data(self, **kwargs):
114114

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

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

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.4 on 2025-02-01 15:56
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('register', '0003_team_faculty'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='team',
15+
name='last_submission',
16+
field=models.PositiveSmallIntegerField(default=0),
17+
),
18+
]

src/register/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class Team(models.Model):
2626
2727
score (PositiveSmallIntegerField): the team's final DOMjudge score
2828
29+
last_submission (PositiveSmallIntegerField): the team's last submission time
30+
2931
num_members (PositiveSmallIntegerField): the number of users on the team
3032
3133
faculty (BooleanField): If True, the team contains at least one faculty member. Otherwise the team does not contain a faculty member.
@@ -43,6 +45,7 @@ class Team(models.Model):
4345
contest_password = models.CharField(max_length=6, unique=True, blank=True, null=True)
4446
questions_answered = models.PositiveSmallIntegerField(default=0)
4547
score = models.PositiveSmallIntegerField(default=0)
48+
last_submission = models.PositiveSmallIntegerField(default=0)
4649
num_members = models.PositiveSmallIntegerField(default=0)
4750
faculty = models.BooleanField(default=False)
4851

0 commit comments

Comments
 (0)