Changeset 778d53d in OpenWorkouts-current for ow/views/user.py


Ignore:
Timestamp:
Mar 5, 2019, 11:45:32 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current
Children:
aa6dcaf
Parents:
35953eb
Message:

(#7) Show per-sport stats in the profile page:

  • Show a dropdown list of sports for which the user has activities. By default we choose the sport with most activities.
  • Show a dropdown list of years for which the user has activities. By default we show stats for the current year. If the user picks up a different year, we show the totals (distance, time, elevation, number of workouts) for that year.
  • Show the totals of all time for the chosen sport
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/views/user.py

    r35953eb r778d53d  
    305305            user_gender = localizer.translate(g[1])
    306306
     307    # get some data to be shown in the "profile stats" totals column
     308    profile_stats = {
     309        'sports': user.activity_sports,
     310        'years': user.activity_years,
     311        'current_year': request.GET.get('stats_year', now.year),
     312        'current_sport': request.GET.get('stats_sport', user.favorite_sport),
     313    }
     314
    307315    return {
    308316        'user': user,
     
    312320            year=str(year), month=str(month).zfill(2)),
    313321        'current_week': week,
    314         'totals': totals
     322        'totals': totals,
     323        'profile_stats': profile_stats
    315324    }
    316325
Note: See TracChangeset for help on using the changeset viewer.