Add tweaks to update notes
This commit is contained in:
parent
e848855072
commit
968162f34e
|
@ -4,7 +4,7 @@
|
|||
from django.contrib import admin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament
|
||||
from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament, Tweak
|
||||
|
||||
|
||||
@admin.register(Team)
|
||||
|
@ -57,3 +57,8 @@ class SynthesisAdmin(admin.ModelAdmin):
|
|||
class TournamentAdmin(admin.ModelAdmin):
|
||||
list_display = ('name',)
|
||||
search_fields = ('name',)
|
||||
|
||||
|
||||
@admin.register(Tweak)
|
||||
class TweakAdmin(admin.ModelAdmin):
|
||||
list_display = ('participation', 'pool', 'diff',)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 3.2.13 on 2022-05-15 14:40
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('participation', '0008_auto_20220429_1853'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Tweak',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('diff', models.IntegerField(help_text='Score to add/remove on the final score', verbose_name='difference')),
|
||||
('participation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tweaks', to='participation.participation', verbose_name='participation')),
|
||||
('pool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='participation.pool', verbose_name='passage')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'tweak',
|
||||
'verbose_name_plural': 'tweaks',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -380,7 +380,8 @@ class Pool(models.Model):
|
|||
return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final)
|
||||
|
||||
def average(self, participation):
|
||||
return sum(passage.average(participation) for passage in self.passages.all())
|
||||
return sum(passage.average(participation) for passage in self.passages.all()) \
|
||||
+ sum(tweak.diff for tweak in participation.tweaks.filter(pool=self).all())
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse_lazy("participation:pool_detail", args=(self.pk,))
|
||||
|
@ -514,6 +515,30 @@ class Passage(models.Model):
|
|||
verbose_name_plural = _("passages")
|
||||
|
||||
|
||||
class Tweak(models.Model):
|
||||
pool = models.ForeignKey(
|
||||
Pool,
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name=_("passage"),
|
||||
)
|
||||
|
||||
participation = models.ForeignKey(
|
||||
Participation,
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name=_("participation"),
|
||||
related_name='tweaks',
|
||||
)
|
||||
|
||||
diff = models.IntegerField(
|
||||
verbose_name=_("difference"),
|
||||
help_text=_("Score to add/remove on the final score"),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("tweak")
|
||||
verbose_name_plural = _("tweaks")
|
||||
|
||||
|
||||
def get_solution_filename(instance, filename):
|
||||
return f"solutions/{instance.participation.team.trigram}_{instance.problem}" \
|
||||
+ ("final" if instance.final_solution else "")
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: TFJM\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-05-15 12:23+0200\n"
|
||||
"POT-Creation-Date: 2022-05-15 16:40+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -120,7 +120,7 @@ msgstr "Ce trigramme est déjà utilisé."
|
|||
msgid "No team was found with this access code."
|
||||
msgstr "Aucune équipe n'a été trouvée avec ce code d'accès."
|
||||
|
||||
#: apps/participation/forms.py:84 apps/participation/forms.py:283
|
||||
#: apps/participation/forms.py:84 apps/participation/forms.py:284
|
||||
#: apps/registration/forms.py:117 apps/registration/forms.py:139
|
||||
#: apps/registration/forms.py:161 apps/registration/forms.py:215
|
||||
msgid "The uploaded file size must be under 2 Mo."
|
||||
|
@ -144,7 +144,7 @@ msgstr "Message à adresser à l'équipe :"
|
|||
msgid "The uploaded file size must be under 5 Mo."
|
||||
msgstr "Le fichier envoyé doit peser moins de 5 Mo."
|
||||
|
||||
#: apps/participation/forms.py:159 apps/participation/forms.py:285
|
||||
#: apps/participation/forms.py:159 apps/participation/forms.py:286
|
||||
msgid "The uploaded file must be a PDF file."
|
||||
msgstr "Le fichier envoyé doit être au format PDF."
|
||||
|
||||
|
@ -167,15 +167,15 @@ msgstr ""
|
|||
msgid "The following note is higher of the maximum expected value:"
|
||||
msgstr "La note suivante est supérieure au maximum attendu :"
|
||||
|
||||
#: apps/participation/forms.py:249
|
||||
#: apps/participation/forms.py:250
|
||||
msgid "The following user was not found:"
|
||||
msgstr "L'utilisateur suivant n'a pas été trouvé :"
|
||||
|
||||
#: apps/participation/forms.py:266
|
||||
#: apps/participation/forms.py:267
|
||||
msgid "The defender, the opponent and the reporter must be different."
|
||||
msgstr "Le défenseur, l'opposant et le rapporteur doivent être différents."
|
||||
|
||||
#: apps/participation/forms.py:270
|
||||
#: apps/participation/forms.py:271
|
||||
msgid "This defender did not work on this problem."
|
||||
msgstr "Ce défenseur ne travaille pas sur ce problème."
|
||||
|
||||
|
@ -305,8 +305,8 @@ msgstr "L'équipe est sélectionnée pour la finale."
|
|||
msgid "Participation of the team {name} ({trigram})"
|
||||
msgstr "Participation de l'équipe {name} ({trigram})"
|
||||
|
||||
#: apps/participation/models.py:331 apps/participation/models.py:530
|
||||
#: apps/participation/models.py:568
|
||||
#: apps/participation/models.py:331 apps/participation/models.py:528
|
||||
#: apps/participation/models.py:555 apps/participation/models.py:593
|
||||
msgid "participation"
|
||||
msgstr "participation"
|
||||
|
||||
|
@ -348,45 +348,45 @@ msgstr ""
|
|||
"Ils restent toujours accessibles pour vous. Seules les moyennes sont "
|
||||
"communiquées."
|
||||
|
||||
#: apps/participation/models.py:389
|
||||
#: apps/participation/models.py:390
|
||||
#, python-brace-format
|
||||
msgid "Pool of day {round} for tournament {tournament} with teams {teams}"
|
||||
msgstr "Poule du jour {round} du tournoi {tournament} avec les équipes {teams}"
|
||||
|
||||
#: apps/participation/models.py:395 apps/participation/models.py:403
|
||||
#: apps/participation/models.py:396 apps/participation/models.py:404
|
||||
msgid "pool"
|
||||
msgstr "poule"
|
||||
|
||||
#: apps/participation/models.py:396
|
||||
#: apps/participation/models.py:397
|
||||
msgid "pools"
|
||||
msgstr "poules"
|
||||
|
||||
#: apps/participation/models.py:408
|
||||
#: apps/participation/models.py:409
|
||||
msgid "defended solution"
|
||||
msgstr "solution défendue"
|
||||
|
||||
#: apps/participation/models.py:410 apps/participation/models.py:537
|
||||
#: apps/participation/models.py:411 apps/participation/models.py:562
|
||||
#, python-brace-format
|
||||
msgid "Problem #{problem}"
|
||||
msgstr "Problème n°{problem}"
|
||||
|
||||
#: apps/participation/models.py:417 apps/participation/tables.py:106
|
||||
#: apps/participation/models.py:418 apps/participation/tables.py:106
|
||||
msgid "defender"
|
||||
msgstr "défenseur"
|
||||
|
||||
#: apps/participation/models.py:424 apps/participation/models.py:580
|
||||
#: apps/participation/models.py:425 apps/participation/models.py:605
|
||||
msgid "opponent"
|
||||
msgstr "opposant"
|
||||
|
||||
#: apps/participation/models.py:431 apps/participation/models.py:581
|
||||
#: apps/participation/models.py:432 apps/participation/models.py:606
|
||||
msgid "reporter"
|
||||
msgstr "rapporteur"
|
||||
|
||||
#: apps/participation/models.py:436
|
||||
#: apps/participation/models.py:437
|
||||
msgid "penalties"
|
||||
msgstr "pénalités"
|
||||
|
||||
#: apps/participation/models.py:438
|
||||
#: apps/participation/models.py:439
|
||||
msgid ""
|
||||
"Number of penalties for the defender. The defender will loose a 0.5 "
|
||||
"coefficient per penalty."
|
||||
|
@ -394,108 +394,124 @@ msgstr ""
|
|||
"Nombre de pénalités pour le défenseur. Le défenseur perd un coefficient 0.5 "
|
||||
"sur sa solution écrite par pénalité."
|
||||
|
||||
#: apps/participation/models.py:498 apps/participation/models.py:501
|
||||
#: apps/participation/models.py:504
|
||||
#: apps/participation/models.py:499 apps/participation/models.py:502
|
||||
#: apps/participation/models.py:505
|
||||
#, python-brace-format
|
||||
msgid "Team {trigram} is not registered in the pool."
|
||||
msgstr "L'équipe {trigram} n'est pas inscrite dans la poule."
|
||||
|
||||
#: apps/participation/models.py:509
|
||||
#: apps/participation/models.py:510
|
||||
#, python-brace-format
|
||||
msgid "Passage of {defender} for problem {problem}"
|
||||
msgstr "Passage de {defender} pour le problème {problem}"
|
||||
|
||||
#: apps/participation/models.py:513 apps/participation/models.py:575
|
||||
#: apps/participation/models.py:617
|
||||
#: apps/participation/models.py:514 apps/participation/models.py:522
|
||||
#: apps/participation/models.py:600 apps/participation/models.py:642
|
||||
msgid "passage"
|
||||
msgstr "passage"
|
||||
|
||||
#: apps/participation/models.py:514
|
||||
#: apps/participation/models.py:515
|
||||
msgid "passages"
|
||||
msgstr "passages"
|
||||
|
||||
#: apps/participation/models.py:535
|
||||
#: apps/participation/models.py:533
|
||||
msgid "difference"
|
||||
msgstr "différence"
|
||||
|
||||
#: apps/participation/models.py:534
|
||||
msgid "Score to add/remove on the final score"
|
||||
msgstr "Score à ajouter/retrancher au score final"
|
||||
|
||||
#: apps/participation/models.py:538
|
||||
msgid "tweak"
|
||||
msgstr "harmonisation"
|
||||
|
||||
#: apps/participation/models.py:539
|
||||
msgid "tweaks"
|
||||
msgstr "harmonisations"
|
||||
|
||||
#: apps/participation/models.py:560
|
||||
msgid "problem"
|
||||
msgstr "numéro de problème"
|
||||
|
||||
#: apps/participation/models.py:542
|
||||
#: apps/participation/models.py:567
|
||||
msgid "solution for the final tournament"
|
||||
msgstr "solution pour la finale"
|
||||
|
||||
#: apps/participation/models.py:547 apps/participation/models.py:586
|
||||
#: apps/participation/models.py:572 apps/participation/models.py:611
|
||||
msgid "file"
|
||||
msgstr "fichier"
|
||||
|
||||
#: apps/participation/models.py:553
|
||||
#: apps/participation/models.py:578
|
||||
#, python-brace-format
|
||||
msgid "Solution of team {team} for problem {problem}"
|
||||
msgstr "Solution de l'équipe {team} pour le problème {problem}"
|
||||
|
||||
#: apps/participation/models.py:555
|
||||
#: apps/participation/models.py:580
|
||||
msgid "for final"
|
||||
msgstr "pour la finale"
|
||||
|
||||
#: apps/participation/models.py:558
|
||||
#: apps/participation/models.py:583
|
||||
msgid "solution"
|
||||
msgstr "solution"
|
||||
|
||||
#: apps/participation/models.py:559
|
||||
#: apps/participation/models.py:584
|
||||
msgid "solutions"
|
||||
msgstr "solutions"
|
||||
|
||||
#: apps/participation/models.py:592
|
||||
#: apps/participation/models.py:617
|
||||
#, python-brace-format
|
||||
msgid "Synthesis of {team} as {type} for problem {problem} of {defender}"
|
||||
msgstr ""
|
||||
"Note de synthèse de l'équipe {team} en tant que {type} pour le problème "
|
||||
"{problem} de {defender}"
|
||||
|
||||
#: apps/participation/models.py:600
|
||||
#: apps/participation/models.py:625
|
||||
msgid "synthesis"
|
||||
msgstr "note de synthèse"
|
||||
|
||||
#: apps/participation/models.py:601
|
||||
#: apps/participation/models.py:626
|
||||
msgid "syntheses"
|
||||
msgstr "notes de synthèse"
|
||||
|
||||
#: apps/participation/models.py:610
|
||||
#: apps/participation/models.py:635
|
||||
msgid "jury"
|
||||
msgstr "jury"
|
||||
|
||||
#: apps/participation/models.py:622
|
||||
#: apps/participation/models.py:647
|
||||
msgid "defender writing note"
|
||||
msgstr "note d'écrit du défenseur"
|
||||
|
||||
#: apps/participation/models.py:628
|
||||
#: apps/participation/models.py:653
|
||||
msgid "defender oral note"
|
||||
msgstr "note d'oral du défenseur"
|
||||
|
||||
#: apps/participation/models.py:634
|
||||
#: apps/participation/models.py:659
|
||||
msgid "opponent writing note"
|
||||
msgstr "note d'écrit de l'opposant"
|
||||
|
||||
#: apps/participation/models.py:640
|
||||
#: apps/participation/models.py:665
|
||||
msgid "opponent oral note"
|
||||
msgstr "note d'oral de l'opposant"
|
||||
|
||||
#: apps/participation/models.py:646
|
||||
#: apps/participation/models.py:671
|
||||
msgid "reporter writing note"
|
||||
msgstr "note d'écrit du rapporteur"
|
||||
|
||||
#: apps/participation/models.py:652
|
||||
#: apps/participation/models.py:677
|
||||
msgid "reporter oral note"
|
||||
msgstr "note d'oral du rapporteur"
|
||||
|
||||
#: apps/participation/models.py:670
|
||||
#: apps/participation/models.py:695
|
||||
#, python-brace-format
|
||||
msgid "Notes of {jury} for {passage}"
|
||||
msgstr "Notes de {jury} pour le {passage}"
|
||||
|
||||
#: apps/participation/models.py:677
|
||||
#: apps/participation/models.py:702
|
||||
msgid "note"
|
||||
msgstr "note"
|
||||
|
||||
#: apps/participation/models.py:678
|
||||
#: apps/participation/models.py:703
|
||||
msgid "notes"
|
||||
msgstr "notes"
|
||||
|
||||
|
@ -1153,15 +1169,15 @@ msgstr "Participation de l'équipe {trigram}"
|
|||
msgid "You can't upload a solution after the deadline."
|
||||
msgstr "Vous ne pouvez pas envoyer de solution après la date limite."
|
||||
|
||||
#: apps/participation/views.py:724
|
||||
#: apps/participation/views.py:730
|
||||
msgid "The following user is not registered as a jury:"
|
||||
msgstr "L'utilisateur suivant n'est pas inscrit en tant que juré⋅e :"
|
||||
|
||||
#: apps/participation/views.py:732
|
||||
#: apps/participation/views.py:738
|
||||
msgid "Notes were successfully uploaded."
|
||||
msgstr "Les notes ont bien été envoyées."
|
||||
|
||||
#: apps/participation/views.py:844
|
||||
#: apps/participation/views.py:850
|
||||
msgid "You can't upload a synthesis after the deadline."
|
||||
msgstr "Vous ne pouvez pas envoyer de note de synthèse après la date limite."
|
||||
|
||||
|
|
Loading…
Reference in New Issue