SamR1/FitTrackee

Create new sport/activities

dkm opened this issue · 4 comments

dkm commented

It would be nice to easily add new activities to the already existing list. I've already started local hacks to add the ones I'm missing, but I'm not even sure how to do that properly (taking inspiration from the "snowshoes" introduction).

In my case, I would need a new sport (paragliding) that would have sub-categories (a bit like cycling actually has transportation, etc):

  • paragliding (hike)
  • paragliding (cross)

I'm also tracking other cycling activities, so would have liked an extra cycling one. Maybe a tag feature would help here?

I'm ok doing these changes (adding few sports to the hardcoded list) myself, but I'm not really sure how to do them:

  • where do you get the svg images? Are you creating them yourself or are you using some external resources?
  • how do you handle the version (I see there are migration files for example)?
  • how do you generate all the static files?
dkm commented

After having imported last year's "workouts", I get several missing activities:

  • paragliding
  • snowboarding
  • tennis
  • swimming
  • cardio
  • treadmill
  • yoga

And I guess the list will quickly grow with every new users. Being able to define activities would really help...

SamR1 commented

Hi,

For now it's not possible for users to add their own sports.

Adding a new sport requires the following changes:

  • on API side, a new sport needs an entry in sports table with a new data migration (with a label, an active status and a default stopped speed threshold used by gpxpy).
    All activities are processed in the same way (FitTrackee is built around GPX files, mainly for outdoor activities, although it's possible to add a workout without a GPX file as a workaround when the gps device fails to save the file (or often in my case when I forget to start recording...)).
  • on client side, a sport has its own Vue component with an SVG icon (the most of icons are from flaticon.com), a default color and translation keys.

You can find the different commands (for migration or static files generation) in the Contributing.md.

By adding custom sports on your local instance, issues may be encountered when upgrading to the next versions (for instance with migrations, the down_revision must be updated before running them).

@SamR1 Are you open for PRs for new sports? Looking intro Contributing.md it explicitly states one should ask.
Coming from Strava I was mainly thinking of two sports which I loved to track here and can see as keeping in-line with keeping FitTrackee Outdoors focused:

  1. Weights/Weightlifting
  2. Calisthenics

Both of these are also available on alternatives such as Strava and belong in any Endurance athlete's workout schedule, no?

Hi,

As FitTrackee is built around GPX files, for the moment only sports associated with a GPX file (mainly outdoor activities) can be added.