From c8184377342ed9409af7af826642e4fa256734da Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 20 Dec 2023 15:00:44 +0100 Subject: [PATCH] API & Client - add new sport: "Cycling (Trekking)" --- .../36_4d51a4ca8001_add_cycling_trekking.py | 34 +++++++++++++ .../Images/SportImage/CyclingTrekking.vue | 48 +++++++++++++++++++ .../Common/Images/SportImage/index.vue | 2 + fittrackee_client/src/locales/en/sports.json | 3 ++ fittrackee_client/src/locales/fr/sports.json | 3 ++ fittrackee_client/src/utils/sports.ts | 1 + 6 files changed, 91 insertions(+) create mode 100644 fittrackee/migrations/versions/36_4d51a4ca8001_add_cycling_trekking.py create mode 100644 fittrackee_client/src/components/Common/Images/SportImage/CyclingTrekking.vue diff --git a/fittrackee/migrations/versions/36_4d51a4ca8001_add_cycling_trekking.py b/fittrackee/migrations/versions/36_4d51a4ca8001_add_cycling_trekking.py new file mode 100644 index 00000000..98984d9c --- /dev/null +++ b/fittrackee/migrations/versions/36_4d51a4ca8001_add_cycling_trekking.py @@ -0,0 +1,34 @@ +"""add cycling (trekking) sport + +Revision ID: 4d51a4ca8001 +Revises: 14f48e46f320 +Create Date: 2023-12-20 13:45:48.654139 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '4d51a4ca8001' +down_revision = '14f48e46f320' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute( + """ + INSERT INTO sports (label, is_active, stopped_speed_threshold) + VALUES ('Cycling (Trekking)', True, 1) + """ + ) + + +def downgrade(): + op.execute( + """ + DELETE FROM sports + WHERE label = 'Cycling (Trekking)'; + """ + ) diff --git a/fittrackee_client/src/components/Common/Images/SportImage/CyclingTrekking.vue b/fittrackee_client/src/components/Common/Images/SportImage/CyclingTrekking.vue new file mode 100644 index 00000000..5b923850 --- /dev/null +++ b/fittrackee_client/src/components/Common/Images/SportImage/CyclingTrekking.vue @@ -0,0 +1,48 @@ + + + diff --git a/fittrackee_client/src/components/Common/Images/SportImage/index.vue b/fittrackee_client/src/components/Common/Images/SportImage/index.vue index 8b42fc24..d807896f 100644 --- a/fittrackee_client/src/components/Common/Images/SportImage/index.vue +++ b/fittrackee_client/src/components/Common/Images/SportImage/index.vue @@ -5,6 +5,7 @@ :title="title ? title : $t(`sports.${sportLabel}.LABEL`)" > + @@ -30,6 +31,7 @@ import CyclingSport from '@/components/Common/Images/SportImage/CyclingSport.vue' import CyclingTransport from '@/components/Common/Images/SportImage/CyclingTransport.vue' + import CyclingTrekking from '@/components/Common/Images/SportImage/CyclingTrekking.vue' import CyclingVirtual from '@/components/Common/Images/SportImage/CyclingVirtual.vue' import Hiking from '@/components/Common/Images/SportImage/Hiking.vue' import MountainBiking from '@/components/Common/Images/SportImage/MountainBiking.vue' diff --git a/fittrackee_client/src/locales/en/sports.json b/fittrackee_client/src/locales/en/sports.json index 93789999..3be4b329 100644 --- a/fittrackee_client/src/locales/en/sports.json +++ b/fittrackee_client/src/locales/en/sports.json @@ -5,6 +5,9 @@ "Cycling (Transport)": { "LABEL": "Cycling (Transport)" }, + "Cycling (Trekking)": { + "LABEL": "Cycling (Trekking)" + }, "Cycling (Virtual)": { "LABEL": "Cycling (Virtual)" }, diff --git a/fittrackee_client/src/locales/fr/sports.json b/fittrackee_client/src/locales/fr/sports.json index 31579918..cdfb06d6 100644 --- a/fittrackee_client/src/locales/fr/sports.json +++ b/fittrackee_client/src/locales/fr/sports.json @@ -5,6 +5,9 @@ "Cycling (Transport)": { "LABEL": "Vélo (Transport)" }, + "Cycling (Trekking)": { + "LABEL": "Vélo (Trekking)" + }, "Cycling (Virtual)": { "LABEL": "Vélo (Virtuel)" }, diff --git a/fittrackee_client/src/utils/sports.ts b/fittrackee_client/src/utils/sports.ts index 6a3ec7f8..c58177d4 100644 --- a/fittrackee_client/src/utils/sports.ts +++ b/fittrackee_client/src/utils/sports.ts @@ -3,6 +3,7 @@ import type { IWorkout } from '@/types/workouts' export const sportColors: Record = { 'Cycling (Sport)': '#4c9792', + 'Cycling (Trekking)': '#a8af88', 'Cycling (Transport)': '#88af98', 'Cycling (Virtual)': '#64a360', Hiking: '#bb757c',