From ea9d7cdd5017fb327c1b346d4d66c6df42b5ca6d Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 22 Jan 2021 18:25:37 +0100 Subject: [PATCH] Use a custom BBB url link, that is not necessary on visio.animath.live --- apps/participation/forms.py | 2 +- .../commands/fix_matrix_channels.py | 2 +- .../migrations/0004_auto_20210122_1827.py | 22 +++++++++++++++++++ apps/participation/models.py | 13 ++++------- 4 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 apps/participation/migrations/0004_auto_20210122_1827.py diff --git a/apps/participation/forms.py b/apps/participation/forms.py index 782cdc1..f80fefe 100644 --- a/apps/participation/forms.py +++ b/apps/participation/forms.py @@ -158,7 +158,7 @@ class SolutionForm(forms.ModelForm): class PoolForm(forms.ModelForm): class Meta: model = Pool - fields = ('tournament', 'round', 'bbb_code', 'juries',) + fields = ('tournament', 'round', 'bbb_url', 'juries',) widgets = { "juries": forms.CheckboxSelectMultiple, } diff --git a/apps/participation/management/commands/fix_matrix_channels.py b/apps/participation/management/commands/fix_matrix_channels.py index 5b67eb1..4be6bb6 100644 --- a/apps/participation/management/commands/fix_matrix_channels.py +++ b/apps/participation/management/commands/fix_matrix_channels.py @@ -323,7 +323,7 @@ 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}-jurys:tfjm.org", avatar_uri) - url_params = urlencode(dict(url=f"https://visio.animath.live/b/{pool.bbb_code}", + url_params = urlencode(dict(url=pool.bbb_url, isAudioConf='false', displayName='$matrix_display_name', avatarUrl='$matrix_avatar_url', userId='$matrix_user_id')) \ .replace("%24", "$") diff --git a/apps/participation/migrations/0004_auto_20210122_1827.py b/apps/participation/migrations/0004_auto_20210122_1827.py new file mode 100644 index 0000000..320c06e --- /dev/null +++ b/apps/participation/migrations/0004_auto_20210122_1827.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0.11 on 2021-01-22 17:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('participation', '0003_team_motivation_letter'), + ] + + operations = [ + migrations.RemoveField( + model_name='pool', + name='bbb_code', + ), + migrations.AddField( + model_name='pool', + name='bbb_url', + field=models.CharField(blank=True, default='', help_text='The link of the BBB visio for this pool.', max_length=255, verbose_name='BigBlueButton URL'), + ), + ] diff --git a/apps/participation/models.py b/apps/participation/models.py index 912125b..76886cf 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -355,19 +355,14 @@ class Pool(models.Model): verbose_name=_("juries"), ) - bbb_code = models.CharField( - max_length=11, + bbb_url = models.CharField( + max_length=255, 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}")], + verbose_name=_("BigBlueButton URL"), + help_text=_("The link of the BBB visio for this pool."), ) - @property - def bbb_url(self): - return f"https://visio.animath.live/b/{self.bbb_code}" - @property def solutions(self): return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final)