Add kayaking activity type (42) across app

Introduces kayaking as a new activity type (ID 42) in backend and frontend. Updates activity mappings, i18n labels, UI components, and search logic to support kayaking alongside rowing where appropriate. #411
This commit is contained in:
João Vitória Silva
2025-11-17 21:34:33 +00:00
parent 77bc227470
commit 2e19ec19b0
8 changed files with 22 additions and 12 deletions

View File

@@ -88,6 +88,7 @@ ACTIVITY_ID_TO_NAME = {
39: "Padel",
40: "Treadmill",
41: "Cardio training",
42: "Kayaking",
# Add other mappings as needed based on the full list in define_activity_type comments if required
# "AlpineSki",
# "BackcountrySki",
@@ -215,6 +216,7 @@ ACTIVITY_NAME_TO_ID.update(
"paddelball": 39,
"treadmill": 40,
"cardio_training": 41,
"kayaking": 42,
}
)
@@ -827,7 +829,7 @@ def calculate_activity_distances(activities: list[activities_schema.Activity]):
walk += activity.distance
elif activity.activity_type in [12]:
hike += activity.distance
elif activity.activity_type in [13]:
elif activity.activity_type in [13, 42]:
rowing += activity.distance
elif activity.activity_type in [15, 16]:
snow_ski += activity.distance

View File

@@ -282,6 +282,7 @@ The table bellow details the activity types supported by Endurain.
| Surf | 33 |
| Soccer | 38 |
| Cardio training | 41 |
| Kayaking | 42 |
## Supported gear types

View File

@@ -76,7 +76,7 @@
<th
scope="col"
style="width: 10%"
v-if="!activityTypeIsSwimming(activity) && activity !== 13"
v-if="!activityTypeIsSwimming(activity) && activityTypeNotRowing(activity)"
>
{{ $t('activityLapsComponent.labelLapElev') }}
</th>

View File

@@ -153,6 +153,9 @@
<option value="13">
{{ $t('editActivityModalComponent.modalEditActivityTypeOption13') }}
</option>
<option value="42">
{{ $t('editActivityModalComponent.modalEditActivityTypeOption42') }}
</option>
<hr />
<option value="14">
{{ $t('editActivityModalComponent.modalEditActivityTypeOption14') }}

View File

@@ -40,5 +40,6 @@
"padel": "Padel",
"treadmillRun": "Treadmill run",
"cardioTraining": "Cardio training",
"kayaking": "Kayaking",
"labelWorkout": " workout"
}
}

View File

@@ -48,6 +48,7 @@
"modalEditActivityTypeOption39": "Padel",
"modalEditActivityTypeOption40": "Treadmill run",
"modalEditActivityTypeOption41": "Cardio training",
"modalEditActivityTypeOption42": "Kayaking",
"modalEditActivityVisibilityLabel": "Visibility",
"modalEditActivityVisibilityOption0": "Public",
"modalEditActivityVisibilityOption1": "Followers",
@@ -67,4 +68,4 @@
"modalEditActivityHideGearLabel": "Hide gear",
"successActivityEdit": "Activity edited successfully",
"errorActivityEdit": "Error editing activity"
}
}

View File

@@ -8,7 +8,7 @@ import { formatDateMed, formatTime, formatSecondsToMinutes } from '@/utils/dateT
*/
const ACTIVITY_TYPES = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42
]
/**
@@ -62,7 +62,8 @@ const activityLabelMap = {
38: (t) => t('activityItems.soccer'),
39: (t) => t('activityItems.padel'),
40: (t) => t('activityItems.treadmillRun'),
41: (t) => t('activityItems.cardioTraining')
41: (t) => t('activityItems.cardioTraining'),
42: (t) => t('activityItems.kayaking')
}
/**
@@ -425,21 +426,21 @@ export function activityTypeNotWindsurf(activity) {
*
* @param {Object} activity - The activity object to check.
* @param {number} activity.activity_type - The type identifier of the activity.
* @returns {boolean} Returns true if the activity type is rowing (13), otherwise false.
* @returns {boolean} Returns true if the activity type is rowing (13, 42), otherwise false.
*/
export function activityTypeIsRowing(activity) {
return activity.activity_type === 13
return activity.activity_type === 13 || activity.activity_type === 42
}
/**
* Checks if the activity type is not rowing (activity_type !== 13).
* Checks if the activity type is not rowing (activity_type !== 13, 42).
*
* @param {Object} activity - The activity object to check.
* @param {number} activity.activity_type - The type of the activity.
* @returns {boolean} Returns true if the activity type is not rowing, false otherwise.
*/
export function activityTypeNotRowing(activity) {
return activity.activity_type !== 13
return activity.activity_type !== 13 && activity.activity_type !== 42
}
/**
@@ -716,7 +717,8 @@ export function getIcon(typeId) {
38: ['fas', 'futbol'],
39: ['fas', 'table-tennis-paddle-ball'],
40: ['fas', 'person-running'], // Treadmill run icon might be better if available
41: ['fas', 'heart-pulse'] // Cardio training icon might be better if available
41: ['fas', 'heart-pulse'], // Cardio training icon might be better if available
42: ['fas', 'sailboat'] // Kayaking icon might be better if available
}
return iconMap[typeId] || ['fas', 'dumbbell']

View File

@@ -282,7 +282,7 @@ function updateSearchResultsBasedOnActivityType() {
)
} else if (searchSelectActivityType.value === '7') {
searchResults.value = searchResultsOriginal.value.filter((user) =>
[13].includes(user.activity_type)
[13, 42].includes(user.activity_type)
)
} else if (searchSelectActivityType.value === '8') {
searchResults.value = searchResultsOriginal.value.filter((user) =>