1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-22 18:21:22 +00:00

Compare commits

..

No commits in common. "35042f077f49ffb95faa0a60731e533f06430977" and "ddaf5e82bd5ddb449747be336f5ce640db14ccf3" have entirely different histories.

6 changed files with 49 additions and 142 deletions

View File

@ -143,7 +143,7 @@ class SolutionForm(forms.ModelForm):
class PoolForm(forms.ModelForm): class PoolForm(forms.ModelForm):
class Meta: class Meta:
model = Pool model = Pool
fields = ('tournament', 'round', 'bbb_code', 'juries',) fields = ('tournament', 'round', 'juries',)
widgets = { widgets = {
"juries": forms.CheckboxSelectMultiple, "juries": forms.CheckboxSelectMultiple,
} }

View File

@ -5,8 +5,6 @@ import os
from asgiref.sync import async_to_sync from asgiref.sync import async_to_sync
from django.core.management import BaseCommand from django.core.management import BaseCommand
from django.utils.http import urlencode
from django.utils.translation import activate
from participation.models import Team, Tournament from participation.models import Team, Tournament
from registration.models import AdminRegistration, Registration, VolunteerRegistration from registration.models import AdminRegistration, Registration, VolunteerRegistration
from tfjm.matrix import Matrix, RoomPreset, RoomVisibility from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
@ -14,8 +12,6 @@ from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): # noqa: C901 def handle(self, *args, **options): # noqa: C901
activate("fr")
Matrix.set_display_name("Bot du TFJM²") Matrix.set_display_name("Bot du TFJM²")
if not os.getenv("SYNAPSE_PASSWORD"): if not os.getenv("SYNAPSE_PASSWORD"):
@ -131,7 +127,6 @@ class Command(BaseCommand):
Matrix.set_room_avatar("#bienvenue:tfjm.org", avatar_uri) Matrix.set_room_avatar("#bienvenue:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#bot:tfjm.org", avatar_uri) Matrix.set_room_avatar("#bot:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#cno:tfjm.org", avatar_uri) Matrix.set_room_avatar("#cno:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#dev-bot:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#faq:tfjm.org", avatar_uri) Matrix.set_room_avatar("#faq:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#flood:tfjm.org", avatar_uri) Matrix.set_room_avatar("#flood:tfjm.org", avatar_uri)
Matrix.set_room_avatar("#je-cherche-une-equipe:tfjm.org", avatar_uri) Matrix.set_room_avatar("#je-cherche-une-equipe:tfjm.org", avatar_uri)
@ -321,17 +316,6 @@ class Command(BaseCommand):
Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}:tfjm.org", avatar_uri) Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}:tfjm.org", avatar_uri)
Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}-jurys:tfjm.org", avatar_uri) Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}-jurys:tfjm.org", avatar_uri)
url_params = urlencode(dict(url=f"https://visio.animath.live/b/{pool.bbb_code}",
isAudioConf='false', displayName='$matrix_display_name',
avatarUrl='$matrix_avatar_url', userId='$matrix_user_id')) \
.replace("%24", "$")
Matrix.add_integration(f"#poule-{slug}-{pool.id}:tfjm.org",
f"https://scalar.vector.im/api/widgets/bigbluebutton.html?{url_params}",
f"bbb-{slug}-{pool.id}", "bigbluebutton", "BigBlueButton", str(pool))
Matrix.add_integration(f"#poule-{slug}-{pool.id}:tfjm.org",
f"https://board.tfjm.org/boards/{slug}-{pool.id}", f"board-{slug}-{pool.id}",
"customwidget", "Tableau", str(pool))
# Invite admins and give permissions # Invite admins and give permissions
for admin in AdminRegistration.objects.all(): for admin in AdminRegistration.objects.all():
Matrix.invite(f"#poule-{slug}-{pool.id}:tfjm.org", f"@{admin.matrix_username}:tfjm.org") Matrix.invite(f"#poule-{slug}-{pool.id}:tfjm.org", f"@{admin.matrix_username}:tfjm.org")

View File

@ -1,19 +0,0 @@
# Generated by Django 3.0.11 on 2021-01-21 16:47
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('participation', '0011_note'),
]
operations = [
migrations.AddField(
model_name='pool',
name='bbb_code',
field=models.CharField(blank=True, default='', help_text='The code of the form xxx-xxx-xxx at the end of the BBB link.', max_length=11, validators=[django.core.validators.RegexValidator('[a-z]{3}-[a-z]{3}-[a-z]{3}')], verbose_name='BigBlueButton code'),
),
]

View File

@ -344,15 +344,6 @@ class Pool(models.Model):
verbose_name=_("juries"), verbose_name=_("juries"),
) )
bbb_code = models.CharField(
max_length=11,
blank=True,
default="",
verbose_name=_("BigBlueButton code"),
help_text=_("The code of the form xxx-xxx-xxx at the end of the BBB link."),
validators=[RegexValidator("[a-z]{3}-[a-z]{3}-[a-z]{3}")],
)
@property @property
def solutions(self): def solutions(self):
return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final) return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final)

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: TFJM\n" "Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-21 17:46+0100\n" "POT-Creation-Date: 2021-01-19 00:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n" "Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -120,32 +120,26 @@ msgstr "Je m'engage à participer à l'intégralité du TFJM²."
msgid "Message to address to the team:" msgid "Message to address to the team:"
msgstr "Message à adresser à l'équipe :" msgstr "Message à adresser à l'équipe :"
#: apps/participation/forms.py:124 #: apps/participation/forms.py:123
msgid "The uploaded file size must be under 5 Mo." msgid "The uploaded file size must be under 5 Mo."
msgstr "Le fichier envoyé doit peser moins de 5 Mo." msgstr "Le fichier envoyé doit peser moins de 5 Mo."
#: apps/participation/forms.py:126 apps/participation/forms.py:189 #: apps/participation/forms.py:125
msgid "The uploaded file must be a PDF file." msgid "The uploaded file must be a PDF file."
msgstr "Le fichier envoyé doit être au format PDF." msgstr "Le fichier envoyé doit être au format PDF."
#: apps/participation/forms.py:130 #: apps/participation/forms.py:129
msgid "The PDF file must not have more than 30 pages." msgid "The PDF file must not have more than 30 pages."
msgstr "Le fichier PDF ne doit pas avoir plus de 30 pages." msgstr "Le fichier PDF ne doit pas avoir plus de 30 pages."
#: apps/participation/forms.py:170 #: apps/participation/forms.py:169
msgid "The defender, the opponent and the reporter must be different." msgid "The defender, the opponent and the reporter must be different."
msgstr "Le défenseur, l'opposant et le rapporteur doivent être différents." msgstr "Le défenseur, l'opposant et le rapporteur doivent être différents."
#: apps/participation/forms.py:174 #: apps/participation/forms.py:173
msgid "This defender did not work on this problem." msgid "This defender did not work on this problem."
msgstr "Ce défenseur ne travaille pas sur ce problème." msgstr "Ce défenseur ne travaille pas sur ce problème."
#: apps/participation/forms.py:187 apps/registration/forms.py:116
#: apps/registration/forms.py:138 apps/registration/forms.py:160
#: apps/registration/forms.py:214
msgid "The uploaded file size must be under 2 Mo."
msgstr "Le fichier envoyé doit peser moins de 2 Mo."
#: apps/participation/models.py:30 apps/participation/models.py:121 #: apps/participation/models.py:30 apps/participation/models.py:121
#: apps/participation/tables.py:17 apps/participation/tables.py:34 #: apps/participation/tables.py:17 apps/participation/tables.py:34
msgid "name" msgid "name"
@ -185,7 +179,7 @@ msgstr "début"
msgid "end" msgid "end"
msgstr "fin" msgstr "fin"
#: apps/participation/models.py:136 apps/participation/models.py:386 #: apps/participation/models.py:136 apps/participation/models.py:377
#: apps/participation/templates/participation/tournament_detail.html:18 #: apps/participation/templates/participation/tournament_detail.html:18
msgid "place" msgid "place"
msgstr "lieu" msgstr "lieu"
@ -263,8 +257,8 @@ msgstr "L'équipe est sélectionnée pour la finale."
msgid "Participation of the team {name} ({trigram})" msgid "Participation of the team {name} ({trigram})"
msgstr "Participation de l'équipe {name} ({trigram})" msgstr "Participation de l'équipe {name} ({trigram})"
#: apps/participation/models.py:315 apps/participation/models.py:508 #: apps/participation/models.py:315 apps/participation/models.py:499
#: apps/participation/models.py:546 #: apps/participation/models.py:537
msgid "participation" msgid "participation"
msgstr "participation" msgstr "participation"
@ -285,148 +279,140 @@ msgstr "Tour {round}"
msgid "juries" msgid "juries"
msgstr "jurys" msgstr "jurys"
#: apps/participation/models.py:352 #: apps/participation/models.py:358
msgid "BigBlueButton code"
msgstr "Code BigBlueButton"
#: apps/participation/models.py:353
msgid "The code of the form xxx-xxx-xxx at the end of the BBB link."
msgstr "Le code de la forme xxx-xxx-xxx à la fin du lien BBB."
#: apps/participation/models.py:367
#, python-brace-format #, python-brace-format
msgid "Pool {round} for tournament {tournament} with teams {teams}" msgid "Pool {round} for tournament {tournament} with teams {teams}"
msgstr "Poule {round} du tournoi {tournament} avec les équipes {teams}" msgstr "Poule {round} du tournoi {tournament} avec les équipes {teams}"
#: apps/participation/models.py:373 apps/participation/models.py:381 #: apps/participation/models.py:364 apps/participation/models.py:372
msgid "pool" msgid "pool"
msgstr "poule" msgstr "poule"
#: apps/participation/models.py:374 #: apps/participation/models.py:365
msgid "pools" msgid "pools"
msgstr "poules" msgstr "poules"
#: apps/participation/models.py:388 #: apps/participation/models.py:379
msgid "Where the solution is presented?" msgid "Where the solution is presented?"
msgstr "Où est-ce que les solutions sont défendues ?" msgstr "Où est-ce que les solutions sont défendues ?"
#: apps/participation/models.py:393 #: apps/participation/models.py:384
msgid "defended solution" msgid "defended solution"
msgstr "solution défendue" msgstr "solution défendue"
#: apps/participation/models.py:395 apps/participation/models.py:515 #: apps/participation/models.py:386 apps/participation/models.py:506
#, python-brace-format #, python-brace-format
msgid "Problem #{problem}" msgid "Problem #{problem}"
msgstr "Problème n°{problem}" msgstr "Problème n°{problem}"
#: apps/participation/models.py:402 apps/participation/tables.py:105 #: apps/participation/models.py:393 apps/participation/tables.py:105
msgid "defender" msgid "defender"
msgstr "défenseur" msgstr "défenseur"
#: apps/participation/models.py:409 apps/participation/models.py:558 #: apps/participation/models.py:400 apps/participation/models.py:549
msgid "opponent" msgid "opponent"
msgstr "opposant" msgstr "opposant"
#: apps/participation/models.py:416 apps/participation/models.py:559 #: apps/participation/models.py:407 apps/participation/models.py:550
msgid "reporter" msgid "reporter"
msgstr "rapporteur" msgstr "rapporteur"
#: apps/participation/models.py:476 apps/participation/models.py:479 #: apps/participation/models.py:467 apps/participation/models.py:470
#: apps/participation/models.py:482 #: apps/participation/models.py:473
#, python-brace-format #, python-brace-format
msgid "Team {trigram} is not registered in the pool." msgid "Team {trigram} is not registered in the pool."
msgstr "L'équipe {trigram} n'est pas inscrite dans la poule." msgstr "L'équipe {trigram} n'est pas inscrite dans la poule."
#: apps/participation/models.py:487 #: apps/participation/models.py:478
#, python-brace-format #, python-brace-format
msgid "Passage of {defender} for problem {problem}" msgid "Passage of {defender} for problem {problem}"
msgstr "Passage de {defender} pour le problème {problem}" msgstr "Passage de {defender} pour le problème {problem}"
#: apps/participation/models.py:491 apps/participation/models.py:553 #: apps/participation/models.py:482 apps/participation/models.py:544
#: apps/participation/models.py:591 #: apps/participation/models.py:582
msgid "passage" msgid "passage"
msgstr "passage" msgstr "passage"
#: apps/participation/models.py:492 #: apps/participation/models.py:483
msgid "passages" msgid "passages"
msgstr "passages" msgstr "passages"
#: apps/participation/models.py:513 #: apps/participation/models.py:504
msgid "problem" msgid "problem"
msgstr "numéro de problème" msgstr "numéro de problème"
#: apps/participation/models.py:520 #: apps/participation/models.py:511
msgid "solution for the final tournament" msgid "solution for the final tournament"
msgstr "solution pour la finale" msgstr "solution pour la finale"
#: apps/participation/models.py:525 apps/participation/models.py:564 #: apps/participation/models.py:516 apps/participation/models.py:555
msgid "file" msgid "file"
msgstr "fichier" msgstr "fichier"
#: apps/participation/models.py:533 #: apps/participation/models.py:524
#, python-brace-format #, python-brace-format
msgid "Solution of team {team} for problem {problem}" msgid "Solution of team {team} for problem {problem}"
msgstr "Solution de l'équipe {team} pour le problème {problem}" msgstr "Solution de l'équipe {team} pour le problème {problem}"
#: apps/participation/models.py:537 #: apps/participation/models.py:528
msgid "solution" msgid "solution"
msgstr "solution" msgstr "solution"
#: apps/participation/models.py:538 #: apps/participation/models.py:529
msgid "solutions" msgid "solutions"
msgstr "solutions" msgstr "solutions"
#: apps/participation/models.py:572 #: apps/participation/models.py:563
#, python-brace-format #, python-brace-format
msgid "Synthesis for the {type} of the {passage}" msgid "Synthesis for the {type} of the {passage}"
msgstr "Synthèse pour {type} du {passage}" msgstr "Synthèse pour {type} du {passage}"
#: apps/participation/models.py:575 #: apps/participation/models.py:566
msgid "synthesis" msgid "synthesis"
msgstr "note de synthèse" msgstr "note de synthèse"
#: apps/participation/models.py:576 #: apps/participation/models.py:567
msgid "syntheses" msgid "syntheses"
msgstr "notes de synthèse" msgstr "notes de synthèse"
#: apps/participation/models.py:584 #: apps/participation/models.py:575
msgid "jury" msgid "jury"
msgstr "jury" msgstr "jury"
#: apps/participation/models.py:596 #: apps/participation/models.py:587
msgid "defender writing note" msgid "defender writing note"
msgstr "note d'écrit du défenseur" msgstr "note d'écrit du défenseur"
#: apps/participation/models.py:602 #: apps/participation/models.py:593
msgid "defender oral note" msgid "defender oral note"
msgstr "note d'oral du défenseur" msgstr "note d'oral du défenseur"
#: apps/participation/models.py:608 #: apps/participation/models.py:599
msgid "opponent writing note" msgid "opponent writing note"
msgstr "note d'écrit de l'opposant" msgstr "note d'écrit de l'opposant"
#: apps/participation/models.py:614 #: apps/participation/models.py:605
msgid "opponent oral note" msgid "opponent oral note"
msgstr "note d'oral de l'opposant" msgstr "note d'oral de l'opposant"
#: apps/participation/models.py:620 #: apps/participation/models.py:611
msgid "reporter writing note" msgid "reporter writing note"
msgstr "not d'écrit du rapporteur" msgstr "not d'écrit du rapporteur"
#: apps/participation/models.py:626 #: apps/participation/models.py:617
msgid "reporter oral note" msgid "reporter oral note"
msgstr "note d'oral du rapporteur" msgstr "note d'oral du rapporteur"
#: apps/participation/models.py:635 #: apps/participation/models.py:626
#, python-brace-format #, python-brace-format
msgid "Notes of {jury} for {passage}" msgid "Notes of {jury} for {passage}"
msgstr "Notes de {jury} pour le {passage}" msgstr "Notes de {jury} pour le {passage}"
#: apps/participation/models.py:642 #: apps/participation/models.py:633
msgid "note" msgid "note"
msgstr "note" msgstr "note"
#: apps/participation/models.py:643 #: apps/participation/models.py:634
msgid "notes" msgid "notes"
msgstr "notes" msgstr "notes"
@ -1031,6 +1017,11 @@ msgstr "bénévole"
msgid "admin" msgid "admin"
msgstr "admin" msgstr "admin"
#: apps/registration/forms.py:116 apps/registration/forms.py:138
#: apps/registration/forms.py:160 apps/registration/forms.py:214
msgid "The uploaded file size must be under 2 Mo."
msgstr "Le fichier envoyé doit peser moins de 2 Mo."
#: apps/registration/forms.py:118 apps/registration/forms.py:140 #: apps/registration/forms.py:118 apps/registration/forms.py:140
#: apps/registration/forms.py:162 apps/registration/forms.py:216 #: apps/registration/forms.py:162 apps/registration/forms.py:216
msgid "The uploaded file must be a PDF, PNG of JPEG file." msgid "The uploaded file must be a PDF, PNG of JPEG file."

View File

@ -263,46 +263,6 @@ class Matrix:
content=content, content=content,
) )
@classmethod
@async_to_sync
async def add_integration(cls, room_id: str, widget_url: str, state_key: str,
widget_type: str = "customwidget", widget_name: str = "Custom widget",
widget_title: str = ""):
client = await cls._get_client()
if room_id.startswith("#"):
room_id = await cls.resolve_room_alias(room_id)
content = {
"type": widget_type,
"url": widget_url,
"name": widget_name,
"data": {
"curl": widget_url,
"title": widget_title,
},
"creatorUserId": client.user,
"roomId": room_id,
"id": state_key,
}
return await client.room_put_state(
room_id=room_id,
event_type="im.vector.modular.widgets",
content=content,
state_key=state_key,
)
@classmethod
@async_to_sync
async def remove_integration(cls, room_id: str, state_key: str):
client = await cls._get_client()
if room_id.startswith("#"):
room_id = await cls.resolve_room_alias(room_id)
return await client.room_put_state(
room_id=room_id,
event_type="im.vector.modular.widgets",
content={},
state_key=state_key,
)
@classmethod @classmethod
@async_to_sync @async_to_sync
async def kick(cls, room_id: str, user_id: str, reason: str = None): async def kick(cls, room_id: str, user_id: str, reason: str = None):