Private
Public Access
1
0

alert boat type

This commit is contained in:
Sander Roosendaal
2019-08-30 08:01:15 +02:00
parent a214f560d2
commit 2e892e7498
4 changed files with 11 additions and 3 deletions

View File

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

View File

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

Binary file not shown.

View File

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