示例#1
0
def get_tabs_for_org_user(organization, active_tab):
    tabs = [{
        'url': reverse('intake-app_unread_index'),
        'label': 'Unread',
        'count': AppsService.get_unread_apps_per_org_count(organization),
        'is_active': False
    }, {
        'url':
        reverse('intake-app_needs_update_index'),
        'label':
        'Needs Status Update',
        'count':
        AppsService.get_needs_update_apps_per_org_count(organization),
        'is_active':
        False
    }, {
        'url': reverse('intake-app_all_index'),
        'label': 'All',
        'count': AppsService.get_all_apps_per_org_count(organization),
        'is_active': False
    }]

    active_tab_count = activate_tab_by_label(tabs, active_tab)

    return tabs, active_tab_count
示例#2
0
def count_unreads_and_send_notifications_to_orgs():
    orgs = get_orgs_that_might_need_a_bundle_email_today()
    for org in orgs:
        if org.slug == 'cfa':
            notifications.slack_simple.send("""
There are {all_count} unhandled county-not-listed (CNL)
applications outstanding: {review_link}""".format(
                all_count=AppsService.get_all_unhandled_cnl_apps().count(),
                review_link=external_reverse('intake-app_cnl_index')))
        else:
            emails = org.get_referral_emails()
            unread_count = AppsService.get_unread_apps_per_org_count(org)
            update_count = AppsService.get_needs_update_apps_per_org_count(org)
            all_count = AppsService.get_all_apps_per_org_count(org)
            if unread_count > 0:
                notifications.front_email_daily_app_bundle.send(
                    to=emails,
                    org_name=org.name,
                    unread_count=unread_count,
                    update_count=update_count,
                    all_count=all_count,
                    unread_redirect_link=external_reverse(
                        'intake-unread_email_redirect'),
                    needs_update_redirect_link=external_reverse(
                        'intake-needs_update_email_redirect'),
                    all_redirect_link=external_reverse(
                        'intake-all_email_redirect'))
            notifications.slack_app_bundle_sent.send(
                org_name=org.name,
                emails=emails,
                unread_count=unread_count,
                update_count=update_count,
                all_count=all_count,
            )
示例#3
0
def count_unreads_and_send_notifications_to_orgs():
    orgs = get_orgs_that_might_need_a_bundle_email_today()
    errors = []
    for org in orgs:
        if org.slug != 'cfa':
            try:
                emails = org.get_referral_emails()
            except Exception as e:
                errors.append(e)
                continue
            unread_count = AppsService.get_unread_apps_per_org_count(org)
            update_count = AppsService.get_needs_update_apps_per_org_count(org)
            all_count = AppsService.get_all_apps_per_org_count(org)
            if unread_count > 0:
                notifications.front_email_daily_app_bundle.send(
                    to=emails,
                    org_name=org.name,
                    unread_count=unread_count,
                    update_count=update_count,
                    all_count=all_count,
                    unread_redirect_link=external_reverse(
                        'intake-unread_email_redirect'),
                    needs_update_redirect_link=external_reverse(
                        'intake-needs_update_email_redirect'),
                    all_redirect_link=external_reverse(
                        'intake-all_email_redirect'))
    if errors:
        raise UnreadNotificationError(errors)
示例#4
0
def get_tabs_for_org_user(organization, active_tab):
    tabs = [
        {
            'url': reverse('intake-app_unread_index'),
            'label': 'Unread',
            'count': AppsService.get_unread_apps_per_org_count(organization),
            'is_active': False},
        {
            'url': reverse('intake-app_needs_update_index'),
            'label': 'Needs Status Update',
            'count': AppsService.get_needs_update_apps_per_org_count(
                organization),
            'is_active': False},
        {
            'url': reverse('intake-app_all_index'),
            'label': 'All',
            'count': AppsService.get_all_apps_per_org_count(organization),
            'is_active': False}
    ]

    active_tab_count = activate_tab_by_label(tabs, active_tab)

    return tabs, active_tab_count
示例#5
0
def count_unreads_and_send_notifications_to_orgs():
    orgs = get_orgs_that_might_need_a_bundle_email_today()
    for org in orgs:
        if org.slug == 'cfa':
            pass
        else:
            emails = org.get_referral_emails()
            unread_count = AppsService.get_unread_apps_per_org_count(org)
            update_count = AppsService.get_needs_update_apps_per_org_count(org)
            all_count = AppsService.get_all_apps_per_org_count(org)
            if unread_count > 0:
                notifications.front_email_daily_app_bundle.send(
                    to=emails,
                    org_name=org.name,
                    unread_count=unread_count,
                    update_count=update_count,
                    all_count=all_count,
                    unread_redirect_link=external_reverse(
                        'intake-unread_email_redirect'),
                    needs_update_redirect_link=external_reverse(
                        'intake-needs_update_email_redirect'),
                    all_redirect_link=external_reverse(
                        'intake-all_email_redirect'))