Skip to content

Conversation

robwakefield
Copy link
Contributor

@robwakefield robwakefield commented May 17, 2025

Summary

An effort to improve the activity view with features specific for swimming activities:

  • Rename "Cadence" to "Stroke rate"
  • Autodetect rests and show rest periods on graphs
  • A lap with pace 00:00 should have a normalizedScore of 0
  • Don't show intensity column in LapComponent if there is no data for any lap

Further details available in Issue #166

@joaovitoriasilva joaovitoriasilva requested a review from Copilot May 20, 2025 15:35
@joaovitoriasilva joaovitoriasilva self-assigned this May 20, 2025
@joaovitoriasilva joaovitoriasilva added the enhancement New feature or request label May 20, 2025
@joaovitoriasilva joaovitoriasilva moved this to In Progress in Endurain project May 20, 2025
@joaovitoriasilva joaovitoriasilva added this to the v0.11.X milestone May 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the activity view specifically for swimming by renaming cadence to stroke rate, autodetecting and displaying rest periods, normalizing zero-pace laps to a score of 0, and hiding the intensity column if no intensity data exists.

  • Rename “Cadence” labels to “Stroke rate” for swimming activities
  • Detect swim rest laps, shade them in charts and tables, and set their normalized score to 0
  • Hide intensity column when no lap has intensity data

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/app/src/utils/activityUtils.js Introduced activityTypeIsSwimming, added isRest handling in formatPace
frontend/app/src/i18n/us/generalItems.json Added translations for rest, laps, and stroke-rate labels
frontend/app/src/components/Activities/ActivityStreamsLineChartComponent.vue Collected stroke-rate data for rest shading and updated chart datasets
frontend/app/src/components/Activities/ActivityLapsComponent.vue Marked rest laps and conditionally show elevation, stroke rate, and intensity
frontend/app/src/components/Activities/ActivityMandAbovePillsComponent.vue Adjusted graph item labels and elevation visibility based on swim type
frontend/app/src/components/Activities/ActivityBellowMPillsComponent.vue Switched cadence to stroke-rate labels and imported swim-type helper
Comments suppressed due to low confidence (4)

frontend/app/src/components/Activities/ActivityLapsComponent.vue:150

  • If lap.enhanced_avg_pace is zero, this division yields Infinity. Add a guard so laps with zero or null pace get normalizedScore = 0 explicitly.
const normalizedScore = (fastestPace / lap.enhanced_avg_pace) * 100;

frontend/app/src/components/Activities/ActivityStreamsLineChartComponent.vue:42

  • [nitpick] The cadLabel variable is populated but never used; consider removing it or wiring it into the dataset’s label property to avoid dead code.
const cadLabel = "";

frontend/app/src/components/Activities/ActivityLapsComponent.vue:134

  • You've added swim rest detection logic here. Consider adding unit tests to verify swimIsRest flags and the two-rest correction loop.
const lapsWithRest = laps.map(lap => {

frontend/app/src/utils/activityUtils.js:156

  • The i18n reference isn’t imported in this module; you need to import your localization instance (e.g. import i18n from '@/i18n') so that i18n.global.t is defined.
return i18n.global.t("generalItems.labelRest");

@joaovitoriasilva joaovitoriasilva linked an issue May 20, 2025 that may be closed by this pull request
@joaovitoriasilva joaovitoriasilva merged commit 1bd6b17 into joaovitoriasilva:master May 22, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Endurain project May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEATURE]: Enhance activity view for swimming activities
2 participants