diff --git a/base/static/css/main.css b/base/static/css/main.css index 80a38b2..219394c 100644 --- a/base/static/css/main.css +++ b/base/static/css/main.css @@ -137,33 +137,3 @@ td.c, th.c { table select { margin-bottom: 0; } - -.podium { - > :first-child { - font-weight: 900; - font-size: 1.25em; - &::marker { - color: var(--pico-color-amber-200); - } - } - > :nth-child(2) { - font-weight: 800; - font-size: 1.1em; - &::marker { - color: var(--pico-color-grey-300); - } - } - > :nth-child(3) { - font-weight: 600; - font-size: 1.1em; - &::marker { - color: var(--pico-color-sand-300); - } - } - - .score { - font-weight: 900; - color: var(--pico-color-zinc-500); - margin-left: .5em; - } -} diff --git a/game/migrations/0020_alter_musikgame_options.py b/game/migrations/0020_alter_musikgame_options.py new file mode 100644 index 0000000..cd933d9 --- /dev/null +++ b/game/migrations/0020_alter_musikgame_options.py @@ -0,0 +1,16 @@ +# Generated by Django 5.2.3 on 2025-06-15 10:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("game", "0019_alter_musikgame_options_musikgame_over"), + ] + + operations = [ + migrations.AlterModelOptions( + name="musikgame", + options={"ordering": ["over", "-date"]}, + ), + ] diff --git a/game/migrations/0020_alter_musikgame_options_musicgameresults.py b/game/migrations/0020_alter_musikgame_options_musicgameresults.py deleted file mode 100644 index 3af5916..0000000 --- a/game/migrations/0020_alter_musikgame_options_musicgameresults.py +++ /dev/null @@ -1,55 +0,0 @@ -# Generated by Django 5.2.3 on 2025-06-15 11:23 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("game", "0019_alter_musikgame_options_musikgame_over"), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.AlterModelOptions( - name="musikgame", - options={"ordering": ["over", "-date"]}, - ), - migrations.CreateModel( - name="MusicGameResults", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("score", models.PositiveIntegerField(default=0)), - ( - "game", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, to="game.musikgame" - ), - ), - ( - "player", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL, - ), - ), - ], - options={ - "ordering": ["-score"], - "constraints": [ - models.UniqueConstraint( - fields=("game", "player"), name="unique_result" - ) - ], - }, - ), - ] diff --git a/game/migrations/0021_alter_musicgameresults_score.py b/game/migrations/0021_alter_musicgameresults_score.py deleted file mode 100644 index 3166d4d..0000000 --- a/game/migrations/0021_alter_musicgameresults_score.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 5.2.3 on 2025-06-15 11:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("game", "0020_alter_musikgame_options_musicgameresults"), - ] - - operations = [ - migrations.AlterField( - model_name="musicgameresults", - name="score", - field=models.IntegerField(default=0), - ), - ] diff --git a/game/models.py b/game/models.py index bf57c6e..a4e1f91 100644 --- a/game/models.py +++ b/game/models.py @@ -129,15 +129,3 @@ class MusicGameAnswer(models.Model): models.UniqueConstraint(fields=("game", "player"), name="unique_answer"), ] ordering = ["game"] - - -class MusicGameResults(models.Model): - game = models.ForeignKey(MusikGame, on_delete=models.CASCADE) - player = models.ForeignKey(User, on_delete=models.CASCADE) - score = models.IntegerField(default=0) - - class Meta: - constraints = [ - models.UniqueConstraint(fields=("game", "player"), name="unique_result") - ] - ordering = ["-score"] diff --git a/game/templates/game/musikgame_detail.html b/game/templates/game/musikgame_detail.html index 5bf75d5..0d84cda 100644 --- a/game/templates/game/musikgame_detail.html +++ b/game/templates/game/musikgame_detail.html @@ -33,17 +33,7 @@

Joueurs

- {% if musikgame.over %} -
    - {% for player in musikgame.musicgameresults_set.all %} -
  1. - {{ player.player.username }} {{ player.score }} -
  2. - {% endfor %} -
- {% else %} -

{{ musikgame.players.all|join:", " }}

- {% endif %} +

{{ musikgame.players.all|join:", " }}

Musiques

@@ -63,7 +53,7 @@

Résultats

-
+
Résultats diff --git a/game/views.py b/game/views.py index b381b61..1e1cae0 100644 --- a/game/views.py +++ b/game/views.py @@ -9,7 +9,7 @@ from django.contrib.auth.models import User from django.contrib.messages.views import SuccessMessageMixin from django.core.exceptions import PermissionDenied from django.db import IntegrityError -from django.db.models import Count, F, Q +from django.db.models import Count, Q from django.shortcuts import get_object_or_404, redirect from django.views import View from django.views.generic import TemplateView @@ -468,25 +468,5 @@ class GameEndView(LoginRequiredMixin, SingleObjectMixin, View): if not game.group.is_leader(request.user): raise PermissionDenied() game.over = True - - for player in game.players.all(): - score = ( - 100 - * player.musicgameanswer_set.filter(game__game=game) - .exclude(game__player=player) - .filter(game__player=F("answer")) - .count() - ) - score -= ( - 50 - * player.musicgameanswer_set.filter(game__game=game) - .filter(game__player=player) - .exclude(game__player=F("answer")) - .count() - ) - models.MusicGameResults.objects.create( - game=game, player=player, score=score - ) - game.save() return redirect("game_detail", pk)