mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-02 19:26:55 +00:00
Compare commits
4 Commits
cf92c78d03
...
ea03bd314b
Author | SHA1 | Date | |
---|---|---|---|
|
ea03bd314b | ||
|
c12972b718 | ||
|
2a775cedc1 | ||
|
9bf3b7dff0 |
@ -15,11 +15,16 @@
|
||||
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
{# Bootstrap + Font Awesome CSS #}
|
||||
{% stylesheet 'bootstrap_fontawesome' %}
|
||||
{# Bootstrap CSS #}
|
||||
<link href="{% static "bootstrap/css/bootstrap.min.css" %}" rel="stylesheet" type="text/css">
|
||||
{# Fontawesome CSS #}
|
||||
<link href="{% static "fontawesome/css/all.min.css" %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static "fontawesome/css/v4-shims.css" %}">
|
||||
{# bootstrap-select CSS #}
|
||||
<link href="{% static "bootstrap-select/css/bootstrap-select.min.css" %}" rel="stylesheet" type="text/css">
|
||||
|
||||
{# Bootstrap JavaScript #}
|
||||
{% javascript 'bootstrap' %}
|
||||
<script type="application/javascript" src="{% static "bootstrap/js/bootstrap.bundle.min.js" %}" charset="utf-8"></script>
|
||||
|
||||
{# Webmanifest PWA permettant l'installation de l'application sur un écran d'accueil, pour navigateurs supportés #}
|
||||
<link rel="manifest" href="{% static "tfjm/chat.webmanifest" %}">
|
||||
|
@ -16,10 +16,13 @@
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
{# Bootstrap CSS #}
|
||||
{% stylesheet 'bootstrap_fontawesome' %}
|
||||
<link href="{% static "bootstrap/css/bootstrap.min.css" %}" rel="stylesheet" type="text/css">
|
||||
{# Fontawesome CSS #}
|
||||
<link href="{% static "fontawesome/css/all.min.css" %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static "fontawesome/css/v4-shims.css" %}">
|
||||
|
||||
{# Bootstrap JavaScript #}
|
||||
{% javascript 'bootstrap' %}
|
||||
<script type="application/javascript" src="{% static "bootstrap/js/bootstrap.bundle.min.js" %}" charset="utf-8"></script>
|
||||
|
||||
{# Webmanifest PWA permettant l'installation de l'application sur un écran d'accueil, pour navigateurs supportés #}
|
||||
<link rel="manifest" href="{% static "tfjm/chat.webmanifest" %}">
|
||||
|
@ -532,7 +532,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||
'visible': True})
|
||||
|
||||
# First send the second pool to have the good team order
|
||||
for r in self.tournament.draw.round_set.filter(number__gte=2).all():
|
||||
async for r in self.tournament.draw.round_set.filter(number__gte=2).all():
|
||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||
{'tid': self.tournament_id, 'type': 'draw.send_poules',
|
||||
'round': r.number,
|
||||
|
@ -128,10 +128,12 @@ class ValidateParticipationForm(forms.Form):
|
||||
class TournamentForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if settings.TFJM_APP != "ETEAM":
|
||||
if settings.NB_ROUNDS < 3:
|
||||
del self.fields['date_third_phase']
|
||||
del self.fields['solutions_available_third_phase']
|
||||
del self.fields['syntheses_third_phase_limit']
|
||||
if not settings.PAYMENT_MANAGEMENT:
|
||||
del self.fields['price']
|
||||
|
||||
class Meta:
|
||||
model = Tournament
|
||||
@ -142,10 +144,13 @@ class TournamentForm(forms.ModelForm):
|
||||
'inscription_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||
'solution_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||
'solutions_draw': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||
'date_first_phase': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||
'syntheses_first_phase_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||
format='%Y-%m-%d %H:%M'),
|
||||
'date_second_phase': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||
'syntheses_second_phase_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||
format='%Y-%m-%d %H:%M'),
|
||||
'date_third_phase': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||
'syntheses_third_phase_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||
format='%Y-%m-%d %H:%M'),
|
||||
'organizers': forms.SelectMultiple(attrs={
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import BaseCommand
|
||||
from django.db.models import Q
|
||||
from participation.models import Team, Tournament
|
||||
@ -13,6 +13,9 @@ class Command(BaseCommand):
|
||||
"""
|
||||
Create Sympa mailing lists and register teams.
|
||||
"""
|
||||
if not settings.ML_MANAGEMENT:
|
||||
return
|
||||
|
||||
sympa = get_sympa_client()
|
||||
|
||||
sympa.create_list("equipes", "Equipes du TFJM2", "hotline",
|
||||
|
@ -239,6 +239,7 @@ class Team(models.Model):
|
||||
if not self.access_code:
|
||||
# if the team got created, generate the access code, create the contact mailing list
|
||||
self.access_code = get_random_string(6)
|
||||
if settings.ML_MANAGEMENT:
|
||||
self.create_mailing_list()
|
||||
|
||||
return super().save(*args, **kwargs)
|
||||
|
@ -1,7 +1,9 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from typing import Union
|
||||
|
||||
from django.conf import settings
|
||||
from participation.models import Note, Participation, Passage, Pool, Team, Tournament
|
||||
from registration.models import Payment
|
||||
from tfjm.lists import get_sympa_client
|
||||
@ -22,7 +24,7 @@ def update_mailing_list(instance: Team, raw, **_):
|
||||
"""
|
||||
When a team name or trigram got updated, update mailing lists
|
||||
"""
|
||||
if instance.pk and not raw:
|
||||
if instance.pk and not raw and settings.ML_MANAGEMENT:
|
||||
old_team = Team.objects.get(pk=instance.pk)
|
||||
if old_team.trigram != instance.trigram:
|
||||
# Delete old mailing list, create a new one
|
||||
@ -41,7 +43,7 @@ def create_payments(instance: Participation, created, raw, **_):
|
||||
"""
|
||||
When a participation got created, create an associated payment.
|
||||
"""
|
||||
if instance.valid and not raw:
|
||||
if instance.valid and not raw and settings.PAYMENT_MANAGEMENT:
|
||||
for student in instance.team.students.all():
|
||||
payment_qs = Payment.objects.filter(registrations=student, final=False)
|
||||
if payment_qs.exists():
|
||||
|
@ -18,8 +18,10 @@
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'place'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{{ tournament.place }}</dd>
|
||||
|
||||
{% if TFJM.PAYMENT_MANAGEMENT %}
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'price'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{% if tournament.price %}{{ tournament.price }} €{% else %}{% trans "Free" %}{% endif %}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'remote'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{{ tournament.remote|yesno }}</dd>
|
||||
@ -42,7 +44,7 @@
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'date of maximal syntheses submission for the second round'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{{ tournament.syntheses_second_phase_limit }}</dd>
|
||||
|
||||
{% if TFJM_APP == "ETEAM" %}
|
||||
{% if TFJM.APP == "ETEAM" %}
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'date of maximal syntheses submission for the third round'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{{ tournament.syntheses_third_phase_limit }}</dd>
|
||||
{% endif %}
|
||||
@ -50,6 +52,7 @@
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'description'|capfirst %}</dt>
|
||||
<dd class="col-sm-6">{{ tournament.description }}</dd>
|
||||
|
||||
{% if TFJM.ML_MANAGEMENT %}
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'To contact organizers' %}</dt>
|
||||
<dd class="col-sm-6"><a href="mailto:{{ tournament.organizers_email }}">{{ tournament.organizers_email }}</a></dd>
|
||||
|
||||
@ -58,6 +61,7 @@
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans 'To contact valid teams' %}</dt>
|
||||
<dd class="col-sm-6"><a href="mailto:{{ tournament.teams_email }}">{{ tournament.teams_email }}</a></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@ -78,6 +82,7 @@
|
||||
{% render_table teams %}
|
||||
</div>
|
||||
|
||||
{% if TFJM.PAYMENT_MANAGEMENT %}
|
||||
{% if user.registration.is_admin or user.registration in tournament.organizers.all %}
|
||||
<div class="text-center">
|
||||
<a href="{% url "participation:tournament_payments" pk=tournament.pk %}" class="btn btn-secondary">
|
||||
@ -85,6 +90,7 @@
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if pools.data %}
|
||||
<hr>
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
import json
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from ...models import Payment
|
||||
@ -15,6 +16,9 @@ class Command(BaseCommand):
|
||||
help = "Vérifie si les paiements Hello Asso initiés sont validés ou non. Si oui, valide les inscriptions."
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if not settings.PAYMENT_MANAGEMENT:
|
||||
return
|
||||
|
||||
for payment in Payment.objects.exclude(valid=True).filter(checkout_intent_id__isnull=False).all():
|
||||
checkout_intent = payment.get_checkout_intent()
|
||||
if checkout_intent is not None and 'order' in checkout_intent:
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Copyright (C) 2024 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from ...models import Payment
|
||||
@ -13,5 +14,8 @@ class Command(BaseCommand):
|
||||
help = "Envoie un mail de rappel à toustes les participant⋅es qui n'ont pas encore payé ou déclaré de paiement."
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if not settings.PAYMENT_MANAGEMENT:
|
||||
return
|
||||
|
||||
for payment in Payment.objects.filter(valid=False).filter(registrations__team__participation__valid=True).all():
|
||||
payment.send_remind_mail()
|
||||
|
@ -146,6 +146,7 @@ class TestRegistration(TestCase):
|
||||
address="1 Rue de Rivoli",
|
||||
zip_code=75001,
|
||||
city="Paris",
|
||||
country="France",
|
||||
phone_number="0123456789",
|
||||
responsible_name="Toto",
|
||||
responsible_phone="0123456789",
|
||||
@ -194,6 +195,7 @@ class TestRegistration(TestCase):
|
||||
address="1 Rue de Rivoli",
|
||||
zip_code=75001,
|
||||
city="Paris",
|
||||
country="France",
|
||||
phone_number="0123456789",
|
||||
professional_activity="God",
|
||||
last_degree="Master",
|
||||
@ -274,11 +276,13 @@ class TestRegistration(TestCase):
|
||||
for user, data in [(self.user, dict(professional_activity="Bot", admin=True)),
|
||||
(self.student, dict(student_class=11, school="Sky", birth_date="2001-01-01",
|
||||
gender="female", address="1 Rue de Rivoli", zip_code=75001,
|
||||
city="Paris", responsible_name="Toto",
|
||||
city="Paris", country="France",
|
||||
responsible_name="Toto",
|
||||
responsible_phone="0123456789",
|
||||
responsible_email="toto@example.com")),
|
||||
(self.coach, dict(professional_activity="God", last_degree="Médaille Fields", gender="male",
|
||||
address="1 Rue de Rivoli", zip_code=75001, city="Paris"))]:
|
||||
address="1 Rue de Rivoli", zip_code=75001,
|
||||
city="Paris", country="France"))]:
|
||||
response = self.client.get(reverse("registration:update_user", args=(user.pk,)))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
@ -837,7 +837,8 @@ class SolutionView(LoginRequiredMixin, View):
|
||||
or user.registration.participates and user.registration.team
|
||||
and (solution.participation.team == user.registration.team or
|
||||
any(passage.pool.round == 1
|
||||
or timezone.now() >= passage.pool.tournament.solutions_available_second_phase
|
||||
or (passage.pool.round == 2 and passage.pool.tournament.solutions_available_second_phase)
|
||||
or (passage.pool.round == 3 and passage.pool.tournament.solutions_available_third_phase)
|
||||
for passage in passage_participant_qs.all()))):
|
||||
raise PermissionDenied
|
||||
# Guess mime type of the file
|
||||
|
@ -5,6 +5,11 @@ from participation.models import Tournament
|
||||
|
||||
def tfjm_context(request):
|
||||
return {
|
||||
'TFJM_APP': settings.TFJM_APP,
|
||||
'SINGLE_TOURNAMENT': Tournament.objects.first() if Tournament.objects.exists() and settings.TFJM_APP else None,
|
||||
'TFJM': {
|
||||
'APP': settings.TFJM_APP,
|
||||
'ML_MANAGEMENT': settings.ML_MANAGEMENT,
|
||||
'PAYMENT_MANAGEMENT': settings.PAYMENT_MANAGEMENT,
|
||||
'SINGLE_TOURNAMENT':
|
||||
Tournament.objects.first() if Tournament.objects.exists() and settings.TFJM_APP else None,
|
||||
}
|
||||
}
|
||||
|
@ -206,25 +206,6 @@ STATICFILES_FINDERS = (
|
||||
PIPELINE = {
|
||||
'DISABLE_WRAPPER': True,
|
||||
'JAVASCRIPT': {
|
||||
'bootstrap': {
|
||||
'source_filenames': {
|
||||
'bootstrap/js/bootstrap.bundle.min.js',
|
||||
},
|
||||
'output_filename': 'tfjm/js/bootstrap.bundle.min.js',
|
||||
},
|
||||
'jquery': {
|
||||
'source_filenames': {
|
||||
'jquery/jquery.min.js',
|
||||
},
|
||||
'output_filename': 'tfjm/js/jquery.min.js',
|
||||
},
|
||||
'bootstrap_select': {
|
||||
'source_filenames': {
|
||||
'bootstrap-select/js/bootstrap-select.min.js',
|
||||
'bootstrap-select/js/defaults-fr_FR.min.js',
|
||||
},
|
||||
'output_filename': 'tfjm/js/bootstrap-select-jquery.min.js',
|
||||
},
|
||||
'main': {
|
||||
'source_filenames': (
|
||||
'tfjm/js/main.js',
|
||||
@ -251,17 +232,6 @@ PIPELINE = {
|
||||
'output_filename': 'tfjm/js/draw.min.js',
|
||||
},
|
||||
},
|
||||
'STYLESHEETS': {
|
||||
'bootstrap_fontawesome': {
|
||||
'source_filenames': (
|
||||
'bootstrap/css/bootstrap.min.css',
|
||||
'fontawesome/css/all.css',
|
||||
'fontawesome/css/v4-shims.css',
|
||||
'bootstrap-select/css/bootstrap-select.min.css',
|
||||
),
|
||||
'output_filename': 'tfjm/css/bootstrap_fontawesome.min.css',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
@ -379,6 +349,8 @@ if TFJM_APP == "TFJM":
|
||||
TEAM_CODE_LENGTH = 3
|
||||
RECOMMENDED_SOLUTIONS_COUNT = 5
|
||||
NB_ROUNDS = 2
|
||||
ML_MANAGEMENT = True
|
||||
PAYMENT_MANAGEMENT = True
|
||||
|
||||
PROBLEMS = [
|
||||
"Triominos",
|
||||
@ -394,6 +366,8 @@ elif TFJM_APP == "ETEAM":
|
||||
TEAM_CODE_LENGTH = 4
|
||||
RECOMMENDED_SOLUTIONS_COUNT = 6
|
||||
NB_ROUNDS = 3
|
||||
ML_MANAGEMENT = False
|
||||
PAYMENT_MANAGEMENT = False
|
||||
|
||||
PROBLEMS = [
|
||||
"Exploring Flatland",
|
||||
|
@ -20,13 +20,18 @@
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
{# Bootstrap CSS #}
|
||||
{% stylesheet 'bootstrap_fontawesome' %}
|
||||
<link href="{% static "bootstrap/css/bootstrap.min.css" %}" rel="stylesheet" type="text/css">
|
||||
{# Fontawesome CSS #}
|
||||
<link href="{% static "fontawesome/css/all.min.css" %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static "fontawesome/css/v4-shims.css" %}">
|
||||
{# bootstrap-select CSS #}
|
||||
<link href="{% static "bootstrap-select/css/bootstrap-select.min.css" %}" rel="stylesheet" type="text/css">
|
||||
|
||||
{# Bootstrap JavaScript #}
|
||||
{% javascript 'bootstrap' %}
|
||||
<script type="application/javascript" src="{% static "bootstrap/js/bootstrap.bundle.min.js" %}" charset="utf-8"></script>
|
||||
{# bootstrap-select for beautiful selects and JQuery dependency #}
|
||||
{% javascript 'jquery' %}
|
||||
{% javascript 'bootstrap_select' %}
|
||||
<script type="application/javascript" src="{% static "jquery/jquery.min.js" %}" charset="utf-8"></script>
|
||||
<script type="application/javascript" src="{% static "bootstrap-select/js/bootstrap-select.min.js" %}" charset="utf-8"></script>
|
||||
|
||||
{# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #}
|
||||
{% if form.media %}
|
||||
|
@ -19,8 +19,8 @@
|
||||
<a href="{% url "index" %}" class="nav-link"><i class="fas fa-home"></i> {% trans "Home" %}</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
{% if SINGLE_TOURNAMENT %}
|
||||
<a href="{% url 'participation:tournament_detail' pk=SINGLE_TOURNAMENT.pk %}" class="nav-link">
|
||||
{% if TFJM.SINGLE_TOURNAMENT %}
|
||||
<a href="{% url 'participation:tournament_detail' pk=TFJM.SINGLE_TOURNAMENT.pk %}" class="nav-link">
|
||||
<i class="fas fa-calendar-day"></i> {% trans "Tournament" %}
|
||||
</a>
|
||||
{% else %}
|
||||
|
Loading…
Reference in New Issue
Block a user