From e6d757c0691414cd43e6e63fc2312d8bbf18b9bc Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:18:56 +0200 Subject: [PATCH 01/13] Update button text in musikgame_answer template for clarity Fix #6 --- game/templates/game/musikgame_answer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/templates/game/musikgame_answer.html b/game/templates/game/musikgame_answer.html index 84e055d..f947802 100644 --- a/game/templates/game/musikgame_answer.html +++ b/game/templates/game/musikgame_answer.html @@ -21,6 +21,6 @@ {% endfor %} - {% if not musikgame.over %}{% endif %} + {% if not musikgame.over %}{% endif %} {% endblock content %} From cb3518a5e517b68d967352e22006543dc65ab86a Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:23:19 +0200 Subject: [PATCH 02/13] Change playlist privacy status from private to unlisted in generate_playlist task Fix #7 --- game/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/tasks.py b/game/tasks.py index 22a7dc0..61937d0 100644 --- a/game/tasks.py +++ b/game/tasks.py @@ -18,7 +18,7 @@ def generate_playlist(creds, game_pk): "description": "Playlist générée par Musik", }, "status": { - "privacyStatus": "private", + "privacyStatus": "unlisted", }, }, ) From 22bb6931e820fa924098dda747b20739a77d7722 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:29:40 +0200 Subject: [PATCH 03/13] Remove individual blacklisting of music in GameCreateView and update all related music to blacklisted in GameEndView Fix #8 --- game/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/game/views.py b/game/views.py index d5f3b7d..20fedff 100644 --- a/game/views.py +++ b/game/views.py @@ -327,8 +327,6 @@ class GameCreateView(LoginRequiredMixin, CreateView): pm_list = list(zip(players, musics)) random.shuffle(pm_list) for (player, music), order in zip(pm_list, range(1, len(pm_list) + 1)): - music.blacklisted = True - music.save() models.MusicGameOrder.objects.create( game=form.instance, player=player, music_video=music, order=order ) @@ -481,6 +479,9 @@ class GameEndView(LoginRequiredMixin, SingleObjectMixin, View): if not game.group.is_leader(request.user): raise PermissionDenied() game.over = True + models.MusicVideo.objects.filter(musicgameorder__game=game).update( + blacklisted=True + ) for go in game.musicgameorder_set.all(): go.update_value() From 0b8ce65a0af6d3e6e8832c924cbb27f7ef753bae Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:33:23 +0200 Subject: [PATCH 04/13] Fix playlist display logic in musikgame_detail template Fix #9 --- game/templates/game/musikgame_detail.html | 40 +++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/game/templates/game/musikgame_detail.html b/game/templates/game/musikgame_detail.html index 67b9921..66708c0 100644 --- a/game/templates/game/musikgame_detail.html +++ b/game/templates/game/musikgame_detail.html @@ -9,31 +9,31 @@ {% endif %} {{ musikgame.date }} - {% if musikgame.playlist or musikgame.playlist_loading %} -
- {% csrf_token %} -
+ + {% csrf_token %} +
+ {% if musikgame.playlist or musikgame.playlist_loading %} Playlist - {% if musikgame.over %} - Mes réponses - {% else %} - Répondre - {% endif %} -
- {% if is_leader and not musikgame.over %} -
- -
{% endif %} - - {% endif %} + {% if musikgame.over %} + Mes réponses + {% else %} + Répondre + {% endif %} +
+ {% if is_leader and not musikgame.over %} +
+ +
+ {% endif %} +

Joueurs

From 951128147cb561f223a5b20075a9ed32dd9dab11 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:44:17 +0200 Subject: [PATCH 05/13] Fix playlist loading logic in MusikGame creation and update related template messages Fix #10 --- game/models.py | 3 +++ game/templates/game/musikgame_form.html | 8 +++++--- game/views.py | 5 ++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/game/models.py b/game/models.py index 18912a0..51eb410 100644 --- a/game/models.py +++ b/game/models.py @@ -99,6 +99,9 @@ def generateYoutubePlaylist(sender, instance, created, **kwargs): if creds := instance.group.owner.youtubecredentials: tasks.generate_playlist.delay_on_commit(creds.credentials, instance.pk) + else: + instance.playlist_loading = False + instance.save() @receiver(post_delete, sender=MusikGame) diff --git a/game/templates/game/musikgame_form.html b/game/templates/game/musikgame_form.html index 38ed5b6..655723a 100644 --- a/game/templates/game/musikgame_form.html +++ b/game/templates/game/musikgame_form.html @@ -5,10 +5,12 @@ {{ group.name }}

- {% if not user.youtubecredentials.credentials %} - Me connecter au compte Youtube + {% if group.owner.youtubecredentials.credentials %} + Une playlist sera générée automatiquement sur le compte Youtube de {{ group.owner }} ({{ group.owner.youtubecredentials.title }}). + {% elif user == group.owner %} + Connecter mon compte Youtube {% else %} - Une playlist sera générée automatiquement sur le compte Youtube {{ user.youtubecredentials.title }}. + Aucune playlist Youtube ne sera générée car {{ group.owner }} n'a pas lié son compte Youtube. {% endif %}

{% form form %} diff --git a/game/views.py b/game/views.py index 20fedff..45685aa 100644 --- a/game/views.py +++ b/game/views.py @@ -331,9 +331,8 @@ class GameCreateView(LoginRequiredMixin, CreateView): game=form.instance, player=player, music_video=music, order=order ) - if models.YoutubeCredentials.objects.filter(user=self.request.user).exists(): - form.instance.playlist_loading = True - form.instance.save() + form.instance.playlist_loading = True + form.instance.save() return res From c639307cfbe5ca0808ac85be8cbd8841a50a956c Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 15:44:37 +0200 Subject: [PATCH 06/13] Add restart policy for RabbitMQ and Postgres services in Docker Compose Fix #11 --- compose.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compose.yaml b/compose.yaml index 04838ec..a6ee8b3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -32,10 +32,12 @@ services: rabbitmq: image: rabbitmq container_name: musik_rabbitmq + restart: unless-stopped postgres: image: postgres:17 container_name: musik_postgres + restart: unless-stopped env_file: stack.env volumes: - /docker/musik/postgres:/var/lib/postgresql/data From 84c432c325bc48d02b8474d16241d01e88df66e9 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 16:16:03 +0200 Subject: [PATCH 07/13] Refactor value calculation in MusicGameOrder to improve scoring logic Fix #13 Close #12 --- game/models.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/game/models.py b/game/models.py index 51eb410..153583f 100644 --- a/game/models.py +++ b/game/models.py @@ -121,13 +121,10 @@ class MusicGameOrder(models.Model): value = models.PositiveIntegerField(default=0) def update_value(self): - n_right = self.musicgameanswer_set.filter(game__player=F("answer")).count() - if n_right == 0: - self.value = 1000 - else: - self.value = 1000 / ( - 1 + ((n_right - 1) / (self.game.players.count() - 1)) ** 0.5 - ) + x = self.musicgameanswer_set.filter(game__player=F("answer")).count() + n = self.game.players.count() + n = max(3, n) + self.value = 1000 * 2 ** (-(x - 2) / (n - 2)) self.save() class Meta: From bd8529cd014f5cea9a3bb35683a273283b57fa91 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 16:17:04 +0200 Subject: [PATCH 08/13] Bump version to 0.4.2 in settings and pyproject.toml --- musik/settings.py | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/musik/settings.py b/musik/settings.py index b69b0cb..a712445 100644 --- a/musik/settings.py +++ b/musik/settings.py @@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/ import os from pathlib import Path -VERSION = "0.4.1" +VERSION = "0.4.2" # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent diff --git a/pyproject.toml b/pyproject.toml index 93cda42..17df9a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "musik" -version = "0.4.1" +version = "0.4.2" description = "Le jeu de Musik." readme = "README.md" requires-python = ">=3.12" diff --git a/uv.lock b/uv.lock index 44c8b62..0e3ae81 100644 --- a/uv.lock +++ b/uv.lock @@ -423,7 +423,7 @@ wheels = [ [[package]] name = "musik" -version = "0.4.1" +version = "0.4.2" source = { virtual = "." } dependencies = [ { name = "celery" }, From b9711cbe9c75b122df5cdc6d11d3b6fcf32fccea Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Mon, 16 Jun 2025 22:04:18 +0200 Subject: [PATCH 09/13] Refactor hero section layout and update footer privacy notice for clarity --- base/static/css/main.css | 47 +++++++++++++++++++++++++++---------- base/templates/footer.html | 2 +- base/templates/hero.html | 24 +++++++++++++++---- base/templates/privacy.html | 3 ++- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/base/static/css/main.css b/base/static/css/main.css index 8120679..74e4488 100644 --- a/base/static/css/main.css +++ b/base/static/css/main.css @@ -77,11 +77,6 @@ article.message { } #hero { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; background: radial-gradient( circle 50vh at calc(100vw - 4rem) 50%, var(--pico-primary-background), @@ -90,19 +85,41 @@ article.message { color-mix(in hsl, var(--pico-primary-background) 30%, var(--pico-background-color)) 60%, color-mix(in hsl, var(--pico-primary-background) 10%, var(--pico-background-color)) 80%, var(--pico-background-color)); - display: grid; - grid-template-rows: 1fr min-content; - align-items: center; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + height: 100%; + overflow-y: auto; padding: 4rem; - .big-logo { - font-size: 8rem; + main { + display: contents; } - - h1 { - font-size: 4rem; + section { + max-width: 20rem; } } +.full-page { + height: 100%; + display: grid; + grid-template-rows: 1fr; + align-items: center; + margin-bottom: 4rem; + + &.r { + -ms-grid-column-align: end; + } + .big-logo { + font-size: 8rem; + } + + h1 { + font-size: 4rem; + } +} + h1, h2, @@ -201,3 +218,7 @@ table.results, table.musics { } } } + +.brand-name { + color: var(--pico-primary); +} diff --git a/base/templates/footer.html b/base/templates/footer.html index 52895f6..6c57641 100644 --- a/base/templates/footer.html +++ b/base/templates/footer.html @@ -1 +1 @@ -Musik {{ VERSION }} – © Edgar P. BurkhartMentions légales +Musik {{ VERSION }} – © Edgar P. BurkhartMentions légales et confidentialité diff --git a/base/templates/hero.html b/base/templates/hero.html index 04c2aee..813c011 100644 --- a/base/templates/hero.html +++ b/base/templates/hero.html @@ -1,11 +1,25 @@ {% load static %}
- -

Musik

-

- Jouer -

+
+
+ +

Musik

+

+ Jouer +

+
+
+
+
+

+ Musik Le jeu où ta playlist devient ton arme secrète ! +

+

+ Invite ta bande, ajoute tes sons fétiches, et c’est parti ! Une playlist Youtube apparaît, mélangeant les coups de cœur de tout le monde. Le jeu ? Écoute, devine qui a choisi quoi, et découvre les secrets musicaux de tes potes. Entre pièges, révélations et fous rires, Musik c’est le jeu parfait pour tester vos oreilles… et vos amitiés. Prêt à jouer le DJ incognito ? +

+
+