Compare commits

..

No commits in common. "70f2be8b179b6fa4b0fe5549252dba27fcf9b1da" and "f327a4c9c4828438b968d128a6440016c071ee7e" have entirely different histories.

12 changed files with 31 additions and 44 deletions

View File

@ -891,7 +891,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
await self.channel_layer.group_send(f"volunteer-{self.tournament.id}", await self.channel_layer.group_send(f"volunteer-{self.tournament.id}",
{'tid': self.tournament_id, 'type': 'draw.dice_visibility', {'tid': self.tournament_id, 'type': 'draw.dice_visibility',
'visible': True}) 'visible': True})
elif r.number == 1 and (self.tournament.final or not settings.HAS_FINAL): elif r.number == 1 and (self.tournament.final or settings.TFJM_APP == "ETEAM"):
# For the final tournament, we wait for a manual update between the two rounds. # For the final tournament, we wait for a manual update between the two rounds.
msg += "<br><br>" + _("The draw of the first round is ended.") msg += "<br><br>" + _("The draw of the first round is ended.")
self.tournament.draw.last_message = msg self.tournament.draw.last_message = msg
@ -1100,6 +1100,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
{'tid': self.tournament_id, 'type': 'draw.dice_visibility', {'tid': self.tournament_id, 'type': 'draw.dice_visibility',
'visible': True}) 'visible': True})
await self.channel_layer.group_send(f"volunteer-{self.tournament.id}", await self.channel_layer.group_send(f"volunteer-{self.tournament.id}",
{'tid': self.tournament_id, 'type': 'draw.dice_visibility', {'tid': self.tournament_id, 'type': 'draw.dice_visibility',
'visible': True}) 'visible': True})

View File

@ -163,7 +163,7 @@ class Draw(models.Model):
"\"My participation\".") "\"My participation\".")
s += "<br><br>" if s else "" s += "<br><br>" if s else ""
rules_link = settings.RULES_LINK rules_link = "https://tfjm.org/reglement" if settings.TFJM_APP == "TFJM" else "https://eteam.tfjm.org/rules/"
s += _("For more details on the draw, the rules are available on " s += _("For more details on the draw, the rules are available on "
"<a class=\"alert-link\" href=\"{link}\">{link}</a>.").format(link=rules_link) "<a class=\"alert-link\" href=\"{link}\">{link}</a>.").format(link=rules_link)
return s return s
@ -419,7 +419,7 @@ class Pool(models.Model):
reporter = tds[line[0]].participation reporter = tds[line[0]].participation
opponent = tds[line[1]].participation opponent = tds[line[1]].participation
reviewer = tds[line[2]].participation reviewer = tds[line[2]].participation
observer = tds[line[3]].participation if self.size >= 4 and settings.HAS_OBSERVER else None observer = tds[line[3]].participation if self.size >= 4 and settings.TFJM_APP == "ETEAM" else None
# Create the passage # Create the passage
await Passage.objects.acreate( await Passage.objects.acreate(

View File

@ -4,8 +4,8 @@
await Notification.requestPermission() await Notification.requestPermission()
})() })()
const TFJM = JSON.parse(document.getElementById('TFJM_settings').textContent) // TODO ETEAM Mieux paramétriser (5 pour le TFJM², 6 pour l'ETEAM)
const RECOMMENDED_SOLUTIONS_COUNT = TFJM.RECOMMENDED_SOLUTIONS_COUNT const RECOMMENDED_SOLUTIONS_COUNT = 6
const problems_count = JSON.parse(document.getElementById('problems_count').textContent) const problems_count = JSON.parse(document.getElementById('problems_count').textContent)

View File

@ -176,7 +176,7 @@
📁 {% trans "Export" %} 📁 {% trans "Export" %}
</button> </button>
</div> </div>
{% if tournament.final or not TFJM.HAS_FINAL %} {% if tournament.final or TFJM.APP == "ETEAM" %}
{# Volunteers can continue the second round for the final tournament #} {# Volunteers can continue the second round for the final tournament #}
<div id="continue-{{ tournament.id }}" <div id="continue-{{ tournament.id }}"
class="card-footer text-center{% if tournament.draw.get_state != 'WAITING_FINAL' %} d-none{% endif %}"> class="card-footer text-center{% if tournament.draw.get_state != 'WAITING_FINAL' %} d-none{% endif %}">
@ -322,21 +322,21 @@
{% elif pool.size == 4 %} {% elif pool.size == 4 %}
{% if forloop.counter == 1 %} {% if forloop.counter == 1 %}
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
{% elif forloop.counter == 2 %} {% elif forloop.counter == 2 %}
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
{% elif forloop.counter == 3 %} {% elif forloop.counter == 3 %}
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
{% elif forloop.counter == 4 %} {% elif forloop.counter == 4 %}
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
@ -344,30 +344,30 @@
{% elif pool.size == 5 %} {% elif pool.size == 5 %}
{% if forloop.counter == 1 %} {% if forloop.counter == 1 %}
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center"></td> <td class="text-center"></td>
{% elif forloop.counter == 2 %} {% elif forloop.counter == 2 %}
<td class="text-center"></td> <td class="text-center"></td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
{% elif forloop.counter == 3 %} {% elif forloop.counter == 3 %}
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center"></td> <td class="text-center"></td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
{% elif forloop.counter == 4 %} {% elif forloop.counter == 4 %}
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center"></td> <td class="text-center"></td>
<td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rep" context "Role abbreviation" %}</td>
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
{% elif forloop.counter == 5 %} {% elif forloop.counter == 5 %}
<td class="text-center">{% if TFJM.HAS_OBSERVER %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td> <td class="text-center">{% if TFJM.APP == "ETEAM" %}{% trans "Obs" context "Role abbreviation" %}{% endif %}</td>
<td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Rev" context "Role abbreviation" %}</td>
<td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td> <td class="text-center">{% trans "Opp" context "Role abbreviation" %}</td>
<td class="text-center"></td> <td class="text-center"></td>

View File

@ -966,7 +966,7 @@ class Participation(models.Model):
reviews_template_begin = f"{settings.STATIC_URL}eteam/Written_review." reviews_template_begin = f"{settings.STATIC_URL}eteam/Written_review."
reviews_templates = "".join(f"<a href='{reviews_template_begin}{ext}'>{ext.upper()}</a>" reviews_templates = "".join(f"<a href='{reviews_template_begin}{ext}'>{ext.upper()}</a>"
for ext in ["pdf", "tex"]) for ext in ["pdf", "tex"])
reviews_templates_content = "<p>" + _('Templates:') + f" {reviews_templates}</p>" reviews_templates_content = "<p>" + _('Templates:') + " {reviews_templates}</p>"
content = reporter_content + opponent_content + reviewer_content + observer_content \ content = reporter_content + opponent_content + reviewer_content + observer_content \
+ reviews_templates_content + reviews_templates_content
@ -1039,7 +1039,7 @@ class Participation(models.Model):
'priority': 1, 'priority': 1,
'content': content, 'content': content,
}) })
elif settings.NB_ROUNDS >= 3 \ elif settings.TFJM_APP == "ETEAM" \
and timezone.now() <= tournament.reviews_third_phase_limit + timedelta(hours=2): and timezone.now() <= tournament.reviews_third_phase_limit + timedelta(hours=2):
reporter_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=3, reporter=self) reporter_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=3, reporter=self)
opponent_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=3, opponent=self) opponent_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=3, opponent=self)
@ -1230,7 +1230,7 @@ class Pool(models.Model):
translation.activate(settings.PREFERRED_LANGUAGE_CODE) translation.activate(settings.PREFERRED_LANGUAGE_CODE)
pool_size = self.participations.count() pool_size = self.participations.count()
has_observer = settings.HAS_OBSERVER and pool_size >= 4 has_observer = settings.TFJM_APP == "ETEAM" and pool_size >= 4
passage_width = 6 + (2 if has_observer else 0) passage_width = 6 + (2 if has_observer else 0)
passages = self.passages.all() passages = self.passages.all()
@ -1638,7 +1638,7 @@ class Pool(models.Model):
if not data or not data[0]: if not data or not data[0]:
return return
has_observer = settings.HAS_OBSERVER and self.participations.count() >= 4 has_observer = settings.TFJM_APP == "ETEAM" and self.participations.count() >= 4
passage_width = 6 + (2 if has_observer else 0) passage_width = 6 + (2 if has_observer else 0)
for line in data: for line in data:
jury_name = line[0] jury_name = line[0]

View File

@ -1259,7 +1259,7 @@ class PoolUploadNotesView(VolunteerMixin, FormView, DetailView):
return self.form_invalid(form) return self.form_invalid(form)
for vr, notes in parsed_notes.items(): for vr, notes in parsed_notes.items():
notes_count = 6 + (2 if pool.participations.count() >= 4 and settings.HAS_OBSERVER else 0) notes_count = 6 + (2 if pool.participations.count() >= 4 and settings.TFJM_APP == "ETEAM" else 0)
for i, passage in enumerate(pool.passages.all()): for i, passage in enumerate(pool.passages.all()):
note = Note.objects.get_or_create(jury=vr, passage=passage)[0] note = Note.objects.get_or_create(jury=vr, passage=passage)[0]
passage_notes = notes[notes_count * i:notes_count * (i + 1)] passage_notes = notes[notes_count * i:notes_count * (i + 1)]
@ -1297,7 +1297,7 @@ class PoolNotesTemplateView(VolunteerMixin, DetailView):
translation.activate(settings.PREFERRED_LANGUAGE_CODE) translation.activate(settings.PREFERRED_LANGUAGE_CODE)
pool_size = self.object.passages.count() pool_size = self.object.passages.count()
has_observer = self.object.participations.count() >= 4 and settings.HAS_OBSERVER has_observer = self.object.participations.count() >= 4 and settings.TFJM_APP == "ETEAM"
passage_width = 6 + (2 if has_observer else 0) passage_width = 6 + (2 if has_observer else 0)
line_length = pool_size * passage_width line_length = pool_size * passage_width

View File

@ -436,8 +436,8 @@ class AuthorizationTemplateView(TemplateView):
if not Tournament.objects.filter(name__iexact=self.request.GET.get("tournament_name")).exists(): if not Tournament.objects.filter(name__iexact=self.request.GET.get("tournament_name")).exists():
raise PermissionDenied("Ce tournoi n'existe pas.") raise PermissionDenied("Ce tournoi n'existe pas.")
context["tournament"] = Tournament.objects.get(name__iexact=self.request.GET.get("tournament_name")) context["tournament"] = Tournament.objects.get(name__iexact=self.request.GET.get("tournament_name"))
elif settings.SINGLE_TOURNAMENT: elif settings.TFJM_APP == "ETEAM":
# One single tournament (for ETEAM) # One single tournament
context["tournament"] = Tournament.objects.first() context["tournament"] = Tournament.objects.first()
else: else:
raise PermissionDenied("Merci d'indiquer un tournoi.") raise PermissionDenied("Merci d'indiquer un tournoi.")

View File

@ -10,16 +10,11 @@ def tfjm_context(request):
'TFJM': { 'TFJM': {
'APP': settings.TFJM_APP, 'APP': settings.TFJM_APP,
'APP_NAME': settings.APP_NAME, 'APP_NAME': settings.APP_NAME,
'HAS_OBSERVER': settings.HAS_OBSERVER,
'HAS_FINAL': settings.HAS_FINAL,
'HOME_PAGE_LINK': settings.HOME_PAGE_LINK,
'LOGO_PATH': "static/tfjm/img/" + settings.LOGO_FILE,
'NB_ROUNDS': settings.NB_ROUNDS, 'NB_ROUNDS': settings.NB_ROUNDS,
'ML_MANAGEMENT': settings.ML_MANAGEMENT, 'ML_MANAGEMENT': settings.ML_MANAGEMENT,
'PAYMENT_MANAGEMENT': settings.PAYMENT_MANAGEMENT, 'PAYMENT_MANAGEMENT': settings.PAYMENT_MANAGEMENT,
'RECOMMENDED_SOLUTIONS_COUNT': settings.RECOMMENDED_SOLUTIONS_COUNT,
'SINGLE_TOURNAMENT': 'SINGLE_TOURNAMENT':
Tournament.objects.first() if Tournament.objects.exists() and settings.SINGLE_TOURNAMENT else None, Tournament.objects.first() if Tournament.objects.exists() and settings.TFJM_APP else None,
'HEALTH_SHEET_REQUIRED': settings.HEALTH_SHEET_REQUIRED, 'HEALTH_SHEET_REQUIRED': settings.HEALTH_SHEET_REQUIRED,
'VACCINE_SHEET_REQUIRED': settings.VACCINE_SHEET_REQUIRED, 'VACCINE_SHEET_REQUIRED': settings.VACCINE_SHEET_REQUIRED,
'MOTIVATION_LETTER_REQUIRED': settings.MOTIVATION_LETTER_REQUIRED, 'MOTIVATION_LETTER_REQUIRED': settings.MOTIVATION_LETTER_REQUIRED,

View File

@ -351,19 +351,14 @@ if TFJM_APP == "TFJM":
TEAM_CODE_LENGTH = 3 TEAM_CODE_LENGTH = 3
RECOMMENDED_SOLUTIONS_COUNT = 5 RECOMMENDED_SOLUTIONS_COUNT = 5
NB_ROUNDS = 2 NB_ROUNDS = 2
HAS_OBSERVER = False
HAS_FINAL = True HAS_FINAL = True
ML_MANAGEMENT = True ML_MANAGEMENT = True
PAYMENT_MANAGEMENT = True PAYMENT_MANAGEMENT = True
SINGLE_TOURNAMENT = True
HEALTH_SHEET_REQUIRED = True HEALTH_SHEET_REQUIRED = True
VACCINE_SHEET_REQUIRED = True VACCINE_SHEET_REQUIRED = True
MOTIVATION_LETTER_REQUIRED = True MOTIVATION_LETTER_REQUIRED = True
SUGGEST_ANIMATH = True SUGGEST_ANIMATH = True
FIRST_EDITION = 2011 FIRST_EDITION = 2011
HOME_PAGE_LINK = "https://tfjm.org/"
LOGO_FILE = "tfjm.svg"
RULES_LINK = "https://tfjm.org/reglement"
PROBLEMS = [ PROBLEMS = [
"Triominos", "Triominos",
@ -381,19 +376,14 @@ elif TFJM_APP == "ETEAM":
TEAM_CODE_LENGTH = 4 TEAM_CODE_LENGTH = 4
RECOMMENDED_SOLUTIONS_COUNT = 6 RECOMMENDED_SOLUTIONS_COUNT = 6
NB_ROUNDS = 3 NB_ROUNDS = 3
HAS_OBSERVER = True
HAS_FINAL = False HAS_FINAL = False
ML_MANAGEMENT = False ML_MANAGEMENT = False
PAYMENT_MANAGEMENT = False PAYMENT_MANAGEMENT = False
SINGLE_TOURNAMENT = True
HEALTH_SHEET_REQUIRED = False HEALTH_SHEET_REQUIRED = False
VACCINE_SHEET_REQUIRED = False VACCINE_SHEET_REQUIRED = False
MOTIVATION_LETTER_REQUIRED = False MOTIVATION_LETTER_REQUIRED = False
SUGGEST_ANIMATH = False SUGGEST_ANIMATH = False
FIRST_EDITION = 2024 FIRST_EDITION = 2024
HOME_PAGE_LINK = "https://eteam.tfjm.org/"
LOGO_FILE = "eteam.png"
RULES_LINK = "https://eteam.tfjm.org/rules/"
PROBLEMS = [ PROBLEMS = [
"Exploring Flatland", "Exploring Flatland",

View File

@ -94,10 +94,8 @@
{% javascript 'main' %} {% javascript 'main' %}
{{ TFJM|json_script:TFJM_settings }}
<script> <script>
const CSRF_TOKEN = "{{ csrf_token }}" CSRF_TOKEN = "{{ csrf_token }}";
document.querySelectorAll(".invalid-feedback").forEach(elem => elem.classList.add('d-block')) document.querySelectorAll(".invalid-feedback").forEach(elem => elem.classList.add('d-block'))
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {

View File

@ -2,8 +2,10 @@
<nav class="navbar navbar-expand-lg fixed-navbar shadow-sm"> <nav class="navbar navbar-expand-lg fixed-navbar shadow-sm">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="{{ TFJM.HOME_PAGE_LINK }}"> {# TODO ETEAM Plus d'uniformité #}
<img src="{% static TFJM.LOGO_PATH %}" style="height: 2em;" alt="Logo {{ TFJM.APP_NAME }}" id="navbar-logo"> <a class="navbar-brand" href="https://eteam.tfjm.org/">
{# TODO ETEAM Plus d'uniformité #}
<img src="{% static "tfjm/img/eteam.png" %}" style="height: 2em;" alt="Logo ETEAM" id="navbar-logo">
</a> </a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNavDropdown" data-bs-target="#navbarNavDropdown"

View File

@ -29,6 +29,7 @@ from registration.views import HealthSheetView, ParentalAuthorizationView, Photo
from .views import AdminSearchView from .views import AdminSearchView
urlpatterns = [ urlpatterns = [
# TODO ETEAM Rendre ça plus joli
path('', TemplateView.as_view(template_name=f"index_{settings.TFJM_APP.lower()}.html", path('', TemplateView.as_view(template_name=f"index_{settings.TFJM_APP.lower()}.html",
extra_context={'title': _("Home")}), extra_context={'title': _("Home")}),
name='index'), name='index'),