def handle(self, *args, **options):
     wrs = WaterRestriction.objects.filter(
         start_time__isnull=False, end_time__isnull=True). \
         select_related('subject'). \
         order_by('subject__nickname')
     for wr in wrs:
         check_water_administration(wr.subject)
Exemple #2
0
 def test_notif_water_2(self):
     # If the last water admin was on June 3 at 12pm, the notification
     # should be created after June 4 at 11am.
     l = ((9, False), (10, False), (11, True), (12, True))
     for (h, r) in l:
         date = timezone.datetime(2018, 6, 4, h, 0, 0)
         check_water_administration(self.subject, date=date)
         notif = Notification.objects.last()
         self.assertTrue((notif is not None) is r)
Exemple #3
0
 def handle(self, *args, **options):
     wrs = WaterRestriction.objects.select_related('subject'). \
         filter(
             subject__death_date__isnull=True,
             start_time__isnull=False,
             end_time__isnull=True). \
         order_by('subject__responsible_user__username', 'subject__nickname')
     for wr in wrs:
         check_water_administration(wr.subject)
Exemple #4
0
 def test_notif_water_1(self):
     date = timezone.datetime(2018, 6, 3, 16, 0, 0)
     check_water_administration(self.subject, date=date)
     notif = Notification.objects.last()
     self.assertTrue(notif is None)