fix alerts
This commit is contained in:
@@ -38,7 +38,7 @@ class Command(BaseCommand):
|
|||||||
testing = False
|
testing = False
|
||||||
|
|
||||||
todaysalerts = Alert.objects.filter(
|
todaysalerts = Alert.objects.filter(
|
||||||
next_run__lte=datetime.date.today(), emailalert=True)
|
next_run__lt=datetime.date.today(), emailalert=True)
|
||||||
|
|
||||||
for alert in todaysalerts:
|
for alert in todaysalerts:
|
||||||
stats = alerts.alert_get_stats(alert)
|
stats = alerts.alert_get_stats(alert)
|
||||||
|
|||||||
@@ -1452,6 +1452,12 @@ class Alert(models.Model):
|
|||||||
boattype = models.CharField(choices=mytypes.boattypes, max_length=50,
|
boattype = models.CharField(choices=mytypes.boattypes, max_length=50,
|
||||||
verbose_name='Boat Type', default='1x')
|
verbose_name='Boat Type', default='1x')
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.next_run > datetime.date.today()+datetime.timedelta(days=self.period):
|
||||||
|
self.next_run = datetime.date.today()+datetime.timedelta(days=self.period)
|
||||||
|
super(Alert, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
metricdict = {key: value for (key, value) in parchoicesy1}
|
metricdict = {key: value for (key, value) in parchoicesy1}
|
||||||
stri = u'Alert {name} on {metric} for {workouttype} - running on {first_name} every {period} days'.format(
|
stri = u'Alert {name} on {metric} for {workouttype} - running on {first_name} every {period} days'.format(
|
||||||
|
|||||||
Reference in New Issue
Block a user