alert boat type
This commit is contained in:
@@ -30,7 +30,8 @@ def create_alert(manager, rower, measured,period=7, emailalert=True,
|
|||||||
reststrokes=reststrokes,
|
reststrokes=reststrokes,
|
||||||
period=period,
|
period=period,
|
||||||
emailalert=emailalert,
|
emailalert=emailalert,
|
||||||
workouttype=workouttype
|
workouttype=workouttype,
|
||||||
|
boattype=boattype,
|
||||||
)
|
)
|
||||||
|
|
||||||
alert.save()
|
alert.save()
|
||||||
@@ -95,7 +96,8 @@ def alert_get_stats(alert,nperiod=0):
|
|||||||
columns += condition.metric
|
columns += condition.metric
|
||||||
|
|
||||||
workouts = Workout.objects.filter(date__gte=startdate,date__lte=enddate,user=alert.rower,
|
workouts = Workout.objects.filter(date__gte=startdate,date__lte=enddate,user=alert.rower,
|
||||||
workouttype=alert.workouttype,duplicate=False)
|
workouttype=alert.workouttype,duplicate=False,
|
||||||
|
boattype=alert.boattype)
|
||||||
ids = [w.id for w in workouts]
|
ids = [w.id for w in workouts]
|
||||||
|
|
||||||
df = getsmallrowdata_db(columns,ids=ids,doclean=True,workstrokesonly=workstrokesonly)
|
df = getsmallrowdata_db(columns,ids=ids,doclean=True,workstrokesonly=workstrokesonly)
|
||||||
|
|||||||
@@ -1082,6 +1082,8 @@ class Alert(models.Model):
|
|||||||
emailalert = models.BooleanField(default=True,verbose_name='Send email alerts')
|
emailalert = models.BooleanField(default=True,verbose_name='Send email alerts')
|
||||||
workouttype = models.CharField(choices=rowchoices,max_length=50,
|
workouttype = models.CharField(choices=rowchoices,max_length=50,
|
||||||
verbose_name='Exercise/Boat Class',default='water')
|
verbose_name='Exercise/Boat Class',default='water')
|
||||||
|
boattype = models.CharField(choices=mytypes.boattypes,max_length=50,
|
||||||
|
verbose_name='Boat Type',default='1x')
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -1145,7 +1147,7 @@ class Alert(models.Model):
|
|||||||
class AlertEditForm(ModelForm):
|
class AlertEditForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Alert
|
model = Alert
|
||||||
fields = ['name','reststrokes','period','emailalert','workouttype']
|
fields = ['name','reststrokes','period','emailalert','workouttype','boattype']
|
||||||
widgets = {
|
widgets = {
|
||||||
'reststrokes':forms.CheckboxInput()
|
'reststrokes':forms.CheckboxInput()
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
@@ -4370,6 +4370,7 @@ def alert_create_view(request,userid=0):
|
|||||||
emailalert = ad['emailalert']
|
emailalert = ad['emailalert']
|
||||||
reststrokes = ad['reststrokes']
|
reststrokes = ad['reststrokes']
|
||||||
workouttype = ad['workouttype']
|
workouttype = ad['workouttype']
|
||||||
|
boattype = ad['boattype']
|
||||||
name = ad['name']
|
name = ad['name']
|
||||||
|
|
||||||
filters = []
|
filters = []
|
||||||
@@ -4391,6 +4392,7 @@ def alert_create_view(request,userid=0):
|
|||||||
|
|
||||||
result,message = create_alert(request.user,r,measured,period=period,emailalert=emailalert,
|
result,message = create_alert(request.user,r,measured,period=period,emailalert=emailalert,
|
||||||
reststrokes=reststrokes,workouttype=workouttype,
|
reststrokes=reststrokes,workouttype=workouttype,
|
||||||
|
boattype=boattype,
|
||||||
filter = filters,
|
filter = filters,
|
||||||
name=name)
|
name=name)
|
||||||
|
|
||||||
@@ -4522,6 +4524,7 @@ def alert_edit_view(request,id=0,userid=0):
|
|||||||
emailalert = ad['emailalert']
|
emailalert = ad['emailalert']
|
||||||
reststrokes = ad['reststrokes']
|
reststrokes = ad['reststrokes']
|
||||||
workouttype = ad['workouttype']
|
workouttype = ad['workouttype']
|
||||||
|
boattype = ad['boattype']
|
||||||
name = ad['name']
|
name = ad['name']
|
||||||
|
|
||||||
m = alert.measured
|
m = alert.measured
|
||||||
@@ -4535,6 +4538,7 @@ def alert_edit_view(request,id=0,userid=0):
|
|||||||
alert.emailalert = emailalert
|
alert.emailalert = emailalert
|
||||||
alert.reststrokes = reststrokes
|
alert.reststrokes = reststrokes
|
||||||
alert.workouttype = workouttype
|
alert.workouttype = workouttype
|
||||||
|
alert.boattype = boattype
|
||||||
alert.name = name
|
alert.name = name
|
||||||
alert.save()
|
alert.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user