Changeset 1d2acd4 in OpenWorkouts-current for ow/models/user.py
- Timestamp:
- Feb 4, 2019, 12:30:27 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 63df989
- Parents:
- 9ab0fe3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/models/user.py
r9ab0fe3 r1d2acd4 77 77 reindex_object(catalog, workout) 78 78 79 def workouts(self, year=None, month=None ):79 def workouts(self, year=None, month=None, week=None): 80 80 """ 81 81 Return this user workouts, sorted by date, from newer to older … … 84 84 if year: 85 85 workouts = [w for w in workouts if w.start.year == year] 86 if month: 87 workouts = [w for w in workouts if w.start.month == month] 86 if month: 87 workouts = [w for w in workouts if w.start.month == month] 88 if week: 89 week = int(week) 90 workouts = [ 91 w for w in workouts if w.start.isocalendar()[1] == week] 88 92 workouts = sorted(workouts, key=attrgetter('start')) 89 93 workouts.reverse()
Note: See TracChangeset
for help on using the changeset viewer.