diff --git a/backend/experiment/actions/score.py b/backend/experiment/actions/score.py index 3ab72c3ca..79930bd1e 100644 --- a/backend/experiment/actions/score.py +++ b/backend/experiment/actions/score.py @@ -27,8 +27,10 @@ def __init__(self, session, title: str = None, score=None, score_message=None, c - feedback: An additional feedback text """ self.session = session - self.title = title or _( - f'Round {session.rounds_passed()} / {self.session.experiment.rounds}') + self.title = title or _('Round {rounds_passed} / {total_rounds}').format( + rounds_passed=session.rounds_passed(), + total_rounds=self.session.experiment.rounds + ) self.score = score or session.last_score() self.score_message = score_message or self.default_score_message self.feedback = feedback diff --git a/backend/experiment/rules/toontjehoger_1_mozart.py b/backend/experiment/rules/toontjehoger_1_mozart.py index d4d5a05f7..d525cd429 100644 --- a/backend/experiment/rules/toontjehoger_1_mozart.py +++ b/backend/experiment/rules/toontjehoger_1_mozart.py @@ -232,7 +232,7 @@ def get_final_round(self, session): body=body, heading="Het Mozart effect", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [*answer_explainer, *score, final, info] diff --git a/backend/experiment/rules/toontjehoger_2_preverbal.py b/backend/experiment/rules/toontjehoger_2_preverbal.py index 47e86f77a..c71c912eb 100644 --- a/backend/experiment/rules/toontjehoger_2_preverbal.py +++ b/backend/experiment/rules/toontjehoger_2_preverbal.py @@ -290,7 +290,7 @@ def get_final_round(self, session): body=body, heading="Het eerste luisteren", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [*score, final, info] diff --git a/backend/experiment/rules/toontjehoger_3_plink.py b/backend/experiment/rules/toontjehoger_3_plink.py index d972b722e..6295bc483 100644 --- a/backend/experiment/rules/toontjehoger_3_plink.py +++ b/backend/experiment/rules/toontjehoger_3_plink.py @@ -311,7 +311,7 @@ def get_final_round(self, session): body=body, heading="Muziekherkenning", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [score, final, info] diff --git a/backend/experiment/rules/toontjehoger_4_absolute.py b/backend/experiment/rules/toontjehoger_4_absolute.py index b875c95ab..c0cffea11 100644 --- a/backend/experiment/rules/toontjehoger_4_absolute.py +++ b/backend/experiment/rules/toontjehoger_4_absolute.py @@ -182,7 +182,7 @@ def get_final_round(self, session): body=body, heading="Absoluut gehoor", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [*score, final, info] diff --git a/backend/experiment/rules/toontjehoger_5_tempo.py b/backend/experiment/rules/toontjehoger_5_tempo.py index 8cef1d035..3f0d965ac 100644 --- a/backend/experiment/rules/toontjehoger_5_tempo.py +++ b/backend/experiment/rules/toontjehoger_5_tempo.py @@ -251,7 +251,7 @@ def get_final_round(self, session): body=body, heading="Timing en tempo", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [*score, final, info] diff --git a/backend/experiment/rules/toontjehoger_6_relative.py b/backend/experiment/rules/toontjehoger_6_relative.py index cf24ad366..4b8f96a38 100644 --- a/backend/experiment/rules/toontjehoger_6_relative.py +++ b/backend/experiment/rules/toontjehoger_6_relative.py @@ -180,7 +180,7 @@ def get_final_round(self, session): body=body, heading="Relatief gehoor", button_label="Terug naar ToontjeHoger", - button_link="/toontjehoger" + button_link="/collection/toontjehoger" ) return [*score, final, info] diff --git a/backend/locale/nl/LC_MESSAGES/django.mo b/backend/locale/nl/LC_MESSAGES/django.mo index a2b93a291..4d90a6b14 100644 Binary files a/backend/locale/nl/LC_MESSAGES/django.mo and b/backend/locale/nl/LC_MESSAGES/django.mo differ diff --git a/backend/locale/nl/LC_MESSAGES/django.po b/backend/locale/nl/LC_MESSAGES/django.po index 9f150c096..f6baf8095 100644 --- a/backend/locale/nl/LC_MESSAGES/django.po +++ b/backend/locale/nl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-11 15:02+0200\n" +"POT-Creation-Date: 2024-06-25 21:58+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -130,33 +130,34 @@ msgstr "" msgid "Select a Playlist" msgstr "" -#: experiment/actions/score.py:31 -msgid "Round {session.rounds_passed()} / {self.session.experiment.rounds}" -msgstr "" +#: experiment/actions/score.py:30 +#, python-brace-format +msgid "Round {rounds_passed} / {total_rounds}" +msgstr "Ronde {rounds_passed} van {total_rounds}" -#: experiment/actions/score.py:43 +#: experiment/actions/score.py:45 #, fuzzy #| msgid "Final score" msgid "Total Score" msgstr "Eindscore" -#: experiment/actions/score.py:44 experiment/rules/musical_preferences.py:125 +#: experiment/actions/score.py:46 experiment/rules/musical_preferences.py:125 msgid "Next" msgstr "Volgende" -#: experiment/actions/score.py:45 +#: experiment/actions/score.py:47 msgid "You listened to:" msgstr "Je luisterde naar:" -#: experiment/actions/score.py:77 +#: experiment/actions/score.py:79 msgid "No points" msgstr "Geen punten" -#: experiment/actions/score.py:80 +#: experiment/actions/score.py:82 msgid "Incorrect" msgstr "Onjuist" -#: experiment/actions/score.py:83 +#: experiment/actions/score.py:85 msgid "Correct" msgstr "Correct" @@ -4025,7 +4026,9 @@ msgstr "punten" msgid "No points yet!" msgstr "Nog geen punten!" -#~ msgid "Round {} / {}" +#, fuzzy, python-format +#~| msgid "Round {} / {}" +#~ msgid "Round %s / %s" #~ msgstr "Ronde {} / {}" #, python-format diff --git a/frontend/src/components/ExperimentCollection/ExperimentCollectionDashboard/ExperimentCollectionDashboard.tsx b/frontend/src/components/ExperimentCollection/ExperimentCollectionDashboard/ExperimentCollectionDashboard.tsx index 6c5b47538..559920b80 100644 --- a/frontend/src/components/ExperimentCollection/ExperimentCollectionDashboard/ExperimentCollectionDashboard.tsx +++ b/frontend/src/components/ExperimentCollection/ExperimentCollectionDashboard/ExperimentCollectionDashboard.tsx @@ -23,6 +23,7 @@ export const ExperimentCollectionDashboard: React.FC = ({ + experimentCollectionTitle, experimentCollectionDescription, nextExperimentSlug, nextExperimentButtonText, @@ -31,11 +32,18 @@ export const Header: React.FC = ({ score, }) => { + // TODO: Fix this permanently and localize in and fetch content from the backend + // See also: https://github.com/Amsterdam-Music-Lab/MUSCLE/issues/1151 + // Get current URL minus the query string + const currentUrl = window.location.href.split('?')[0]; + const message = totalScore > 0 ? `Ha! Ik ben muzikaler dan ik dacht - heb maar liefst ${totalScore} punten! Speel mee met #ToontjeHoger` : "Ha! Speel mee met #ToontjeHoger en laat je verrassen: je bent muzikaler dat je denkt!"; + const hashtags = [experimentCollectionTitle ? experimentCollectionTitle.replace(/ /g, '') : 'amsterdammusiclab']; + const social = { - 'apps': ['facebook', 'twitter'], - 'message': `I scored ${totalScore} points`, - 'url': 'wwww.amsterdammusiclab.nl', - 'hashtags': ["amsterdammusiclab", "citizenscience"] + apps: ['facebook', 'twitter'], + message, + url: currentUrl, + hashtags, } const useAnimatedScore = (targetScore: number) => { diff --git a/package.json b/package.json index c9e6944be..fe200f419 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muscle", - "version": "2.2.3", + "version": "2.2.4", "private": false, "description": "The MUSCLE platform is an application that provides an easy way to implement and run online listening experiments for music research.", "license": "MIT",