excluding strava from analysis
This commit is contained in:
@@ -1423,9 +1423,26 @@ parchoicesy1 = list(sorted(favchartlabelsy1.items(), key=lambda x: x[1]))
|
||||
parchoicesy2 = list(sorted(favchartlabelsy2.items(), key=lambda x: x[1]))
|
||||
parchoicesx = list(sorted(favchartlabelsx.items(), key=lambda x: x[1]))
|
||||
|
||||
# special filter for workouts to exclude strava workouts by default
|
||||
class WorkoutQuerySet(models.QuerySet):
|
||||
def filter(self, *args, exclude_strava=True, **kwargs):
|
||||
queryset = super().filter(*args, **kwargs)
|
||||
if exclude_strava:
|
||||
queryset = queryset.exclude(workoutsource='strava')
|
||||
|
||||
return queryset
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
queryset = self
|
||||
|
||||
return super().get(*args, **kwargs)
|
||||
|
||||
|
||||
class WorkoutManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
return WorkoutQuerySet(self.model, using=self._db)
|
||||
|
||||
# Saving a chart as a favorite chart
|
||||
|
||||
|
||||
class FavoriteChart(models.Model):
|
||||
workouttypechoices = [
|
||||
('ote', 'Erg/SkiErg'),
|
||||
@@ -3704,6 +3721,9 @@ class Workout(models.Model):
|
||||
default=False, verbose_name='Duplicate Workout')
|
||||
impeller = models.BooleanField(default=False, verbose_name='Impeller')
|
||||
|
||||
# attach the WorkoutManager
|
||||
#objects = WorkoutManager()
|
||||
|
||||
def url(self):
|
||||
str = '/rowers/workout/{id}/'.format(
|
||||
id=encoder.encode_hex(self.id)
|
||||
|
||||
Reference in New Issue
Block a user