alert boat type
This commit is contained in:
@@ -30,7 +30,8 @@ def create_alert(manager, rower, measured,period=7, emailalert=True,
|
||||
reststrokes=reststrokes,
|
||||
period=period,
|
||||
emailalert=emailalert,
|
||||
workouttype=workouttype
|
||||
workouttype=workouttype,
|
||||
boattype=boattype,
|
||||
)
|
||||
|
||||
alert.save()
|
||||
@@ -95,7 +96,8 @@ def alert_get_stats(alert,nperiod=0):
|
||||
columns += condition.metric
|
||||
|
||||
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]
|
||||
|
||||
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')
|
||||
workouttype = models.CharField(choices=rowchoices,max_length=50,
|
||||
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):
|
||||
@@ -1145,7 +1147,7 @@ class Alert(models.Model):
|
||||
class AlertEditForm(ModelForm):
|
||||
class Meta:
|
||||
model = Alert
|
||||
fields = ['name','reststrokes','period','emailalert','workouttype']
|
||||
fields = ['name','reststrokes','period','emailalert','workouttype','boattype']
|
||||
widgets = {
|
||||
'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']
|
||||
reststrokes = ad['reststrokes']
|
||||
workouttype = ad['workouttype']
|
||||
boattype = ad['boattype']
|
||||
name = ad['name']
|
||||
|
||||
filters = []
|
||||
@@ -4391,6 +4392,7 @@ def alert_create_view(request,userid=0):
|
||||
|
||||
result,message = create_alert(request.user,r,measured,period=period,emailalert=emailalert,
|
||||
reststrokes=reststrokes,workouttype=workouttype,
|
||||
boattype=boattype,
|
||||
filter = filters,
|
||||
name=name)
|
||||
|
||||
@@ -4522,6 +4524,7 @@ def alert_edit_view(request,id=0,userid=0):
|
||||
emailalert = ad['emailalert']
|
||||
reststrokes = ad['reststrokes']
|
||||
workouttype = ad['workouttype']
|
||||
boattype = ad['boattype']
|
||||
name = ad['name']
|
||||
|
||||
m = alert.measured
|
||||
@@ -4535,6 +4538,7 @@ def alert_edit_view(request,id=0,userid=0):
|
||||
alert.emailalert = emailalert
|
||||
alert.reststrokes = reststrokes
|
||||
alert.workouttype = workouttype
|
||||
alert.boattype = boattype
|
||||
alert.name = name
|
||||
alert.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user