Changeset 1183d5a in OpenWorkouts-current for ow/views/user.py


Ignore:
Timestamp:
Jan 31, 2019, 3:25:08 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
3357e47
Parents:
ed7e9d7 (diff), dbfab70 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged patches from darcs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/views/user.py

    red7e9d7 r1183d5a  
    166166    """
    167167    now = datetime.now(timezone.utc)
    168     return {
    169         'current_month': now.strftime('%Y-%m')
     168    year = int(request.GET.get('year', now.year))
     169    month = int(request.GET.get('month', now.month))
     170    return {
     171        'workouts': context.workouts(year, month),
     172        'current_month': '{year}-{month}'.format(
     173            year=str(year), month=str(month).zfill(2))
    170174    }
    171175
     
    280284            'distance': int(round(stats[month]['distance'])),
    281285            'elevation': int(stats[month]['elevation']),
    282             'workouts': stats[month]['workouts']
     286            'workouts': stats[month]['workouts'],
     287            'url': request.resource_url(
     288                context, 'profile',
     289                query={'year': str(month[0]), 'month': str(month[1])},
     290                anchor='workouts')
    283291        }
    284292        json_stats.append(month_stats)
Note: See TracChangeset for help on using the changeset viewer.