예제 #1
0
def release_time_repeating_slot(application_id):
    organisations = repo.get_organisations_for_person(
        current_user.person_id, auth_token_username=current_user.user_id)

    umbrella_orgs = repo.get_umbrella_organisations_for_person(current_user.person_id, auth_token_username=current_user.user_id)
    for umbrella_org in umbrella_orgs:
        umbrella_member_orgs = repo.get_umbrella_org_member_organisations(umbrella_org.get('id'), auth_token_username=current_user.user_id)
        organisations.extend(
            [umb_memb.get('organisation') for umb_memb in umbrella_member_orgs if not any(umb_memb.get('organisation').get('uri') == org.get('uri') for org in organisations)])

    try:
        repeating_application = repo.get_application(
            application_id,
            auth_token_username=current_user.user_id
        )
        # Show deleted facilities
        params = dict(show_deleted=True, show_not_published=True)
        facilities = repo.get_facilities(auth_token_username=current_user.user_id, params=params)
        map_applications_to_facilities([repeating_application], facilities)
        map_organisations_to_applications([repeating_application], organisations)
        return render_flod_template(
            'release_time_repeating_application.html',
            repeating_application=json.dumps(repeating_application)
        )
    except requests.exceptions.ConnectionError:
        app.logger.exception('Request failed')
        return "", 500
예제 #2
0
def applications():
    """Render application list page."""
    organisations = repo.get_organisations_for_person(
        current_user.person_id, auth_token_username=current_user.user_id)
    umbrella_orgs = repo.get_umbrella_organisations_for_person(current_user.person_id, auth_token_username=current_user.user_id)
    for umbrella_org in umbrella_orgs:
        umbrella_member_orgs = repo.get_umbrella_org_member_organisations(umbrella_org.get('id'), auth_token_username=current_user.user_id)
        organisations.extend(
            [umb_memb.get('organisation') for umb_memb in umbrella_member_orgs if not any(umb_memb.get('organisation').get('uri') == org.get('uri') for org in organisations)])

    try:
        applications = repo.get_applications(
            # person_uri=user["person_uri"],
            auth_token_username=current_user.user_id
        )

        # Show deleted facilities
        params = dict(show_deleted=True, show_not_published=True)
        facilities = repo.get_facilities(auth_token_username=current_user.user_id, params=params)
        map_applications_to_facilities(applications, facilities)
        map_organisations_to_applications(applications, organisations)
        get_and_map_persons_to_applications(applications)
        return render_flod_template(
            'applications.html',
            applications=json.dumps(applications)
        )

    except requests.exceptions.ConnectionError:
        app.logger.exception('Request failed')
        return "", 500