Exemplo n.º 1
0
def get_orgs_that_might_need_a_bundle_email_today():
    """Returns Organizations which:
        - are receiving agencies
        - are checking notifications
        - have at least one user
        - have at least one submission
    and if today is the weekend:
        - should be notified on weekends
    """
    orgs = Organization.objects.annotate(
        profile_count=Count('profiles'),
        submission_count=Count('submissions'),
    ).filter(is_checking_notifications=True,
             is_receiving_agency=True,
             profile_count__gte=1,
             submission_count__gte=1)
    if is_the_weekend():
        return orgs.filter(notify_on_weekends=True)
    return orgs
Exemplo n.º 2
0
 def handle(self, *args, **options):
     if not is_the_weekend():
         FollowupsService.send_all_followups_that_are_due(after_id=465)
         self.stdout.write(
             self.style.SUCCESS("Successfully sent followups")
         )
Exemplo n.º 3
0
 def handle(self, *args, **options):
     if not is_the_weekend():
         FollowupsService.send_all_followups_that_are_due(after_id=465)
         self.stdout.write(
             self.style.SUCCESS("Successfully sent followups"))