Merge branch 'develop' into feature/icu_sessions
This commit is contained in:
@@ -1174,6 +1174,7 @@ class Rower(models.Model):
|
||||
c2_auto_import = models.BooleanField(default=False)
|
||||
intervals_auto_export = models.BooleanField(default=False)
|
||||
intervals_auto_import = models.BooleanField(default=False)
|
||||
intervals_resample_to_1s = models.BooleanField(default=False, verbose_name='Resample to 1s on export')
|
||||
sporttrackstoken = models.CharField(
|
||||
default='', max_length=200, blank=True, null=True)
|
||||
sporttrackstokenexpirydate = models.DateTimeField(blank=True, null=True)
|
||||
@@ -1240,7 +1241,7 @@ class Rower(models.Model):
|
||||
|
||||
strava_auto_export = models.BooleanField(default=False)
|
||||
strava_auto_import = models.BooleanField(default=False)
|
||||
strava_auto_delete = models.BooleanField(default=False)
|
||||
strava_auto_delete = models.BooleanField(default=True)
|
||||
|
||||
intervals_token = models.CharField(
|
||||
default='', max_length=200, blank=True, null=True)
|
||||
@@ -1440,9 +1441,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'),
|
||||
@@ -3740,6 +3758,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)
|
||||
@@ -4578,7 +4599,78 @@ class RowerExportForm(ModelForm):
|
||||
'rp3_auto_import',
|
||||
'intervals_auto_import',
|
||||
'intervals_auto_export',
|
||||
'intervals_resample_to_1s'
|
||||
]
|
||||
|
||||
class RowerExportFormStrava(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'stravaexportas',
|
||||
'strava_auto_export',
|
||||
'strava_auto_import',
|
||||
'strava_auto_delete',
|
||||
]
|
||||
|
||||
class RowerExportFormIntervals(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'intervals_auto_import',
|
||||
'intervals_auto_export',
|
||||
'intervals_resample_to_1s',
|
||||
]
|
||||
|
||||
class RowerExportFormGarmin(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'garminactivity',
|
||||
]
|
||||
|
||||
class RowerExportFormPolar(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'polar_auto_import',
|
||||
]
|
||||
|
||||
class RowerExportFormConcept2(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'c2_auto_export',
|
||||
'c2_auto_import',
|
||||
]
|
||||
|
||||
class RowerExportFormSportTracks(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'sporttracks_auto_export',
|
||||
]
|
||||
|
||||
class RowerExportFormTrainingPeaks(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'trainingpeaks_auto_export',
|
||||
]
|
||||
|
||||
class RowerExportFormRP3(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'rp3_auto_import',
|
||||
]
|
||||
|
||||
class RowerExportFormNK(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = [
|
||||
'nk_auto_import'
|
||||
]
|
||||
|
||||
|
||||
# Simple form to set rower's Functional Threshold Power
|
||||
class SimpleRowerPowerForm(ModelForm):
|
||||
|
||||
Reference in New Issue
Block a user