Private
Public Access
1
0

excluding strava from analysis

This commit is contained in:
2024-12-04 21:02:58 +01:00
parent fd7e7e35e5
commit 1daed90104
8 changed files with 138 additions and 25 deletions

View File

@@ -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)