Esempio n. 1
0
def analysis_results(request, project_id=None, questionnaire_code=None):
    manager = get_database_manager(request.user)
    org_id = helper.get_org_id_by_user(request.user)

    if request.method == 'GET':
        questionnaire = Project.get(manager, project_id)
        dashboard_page = settings.HOME_PAGE + "?deleted=true"
        if questionnaire.is_void():
            return HttpResponseRedirect(dashboard_page)

        filterable_fields = get_filterable_fields(questionnaire.fields, [])
        first_filterable_fields = filterable_fields.pop(
            0) if filterable_fields else None

        result_dict = {
            "xform": questionnaire.xform,
            "user_email": request.user.email,
            "is_quota_reached": is_quota_reached(request, org_id=org_id),
            "first_filterable_field": first_filterable_fields,
            "filterable_fields": filterable_fields,
            'is_pro_sms': get_organization(request).is_pro_sms,
            "is_media_field_present":
            questionnaire.is_media_type_fields_present
            # first 3 columns are additional submission data fields (ds_is, ds_name and submission_status
        }
        result_dict.update(
            project_info(request, questionnaire, questionnaire_code))
        return render_to_response('project/analysis_results.html',
                                  result_dict,
                                  context_instance=RequestContext(request))
def analysis_results(request, project_id=None, questionnaire_code=None):
    manager = get_database_manager(request.user)

    form_model = get_form_model_by_code(manager, questionnaire_code)
    org_id = helper.get_org_id_by_user(request.user)

    if request.method == 'GET':
        result_dict = {
            "is_quota_reached": is_quota_reached(request, org_id=org_id),
        }
        result_dict.update(
            project_info(request, manager, form_model, project_id,
                         questionnaire_code))
        return render_to_response('project/analysis_results.html',
                                  result_dict,
                                  context_instance=RequestContext(request))
Esempio n. 3
0
def index(request, project_id=None, questionnaire_code=None, tab=0):
    manager = get_database_manager(request.user)
    org_id = helper.get_org_id_by_user(request.user)

    if request.method == 'GET':
        questionnaire = Project.get(manager, project_id)
        if questionnaire.is_void():
            dashboard_page = settings.HOME_PAGE + "?deleted=true"
            return HttpResponseRedirect(dashboard_page)

        filterable_fields = get_filterable_fields(questionnaire.fields, [])
        duplicates_filter_list = add_static_filterable_fields_for_duplicates(
            [])

        duplicates_filter_list = get_duplicates_filterable_fields(
            questionnaire.fields, duplicates_filter_list)
        first_filterable_fields = filterable_fields.pop(
            0) if filterable_fields else None
        xform = questionnaire.xform
        is_repeat_present = questionnaire.is_repeat_field_present

        result_dict = {
            "user_email": request.user.email,
            "tab": tab,
            "xform": xform,
            'is_pro_sms': get_organization(request).is_pro_sms,
            "is_poll": questionnaire.is_poll,
            # first 3 columns are additional submission data fields (ds_is, ds_name and submission_status)
            "is_quota_reached": is_quota_reached(request, org_id=org_id),
            "first_filterable_field": first_filterable_fields,
            "filterable_fields": filterable_fields,
            "duplicates_filter_list": duplicates_filter_list,
            "is_media_field_present":
            questionnaire.is_media_type_fields_present,
            "is_repeat_field_present": is_repeat_present
        }

        result_dict.update(
            project_info(request, questionnaire, questionnaire_code))
        return render_to_response('project/submission_results.html',
                                  result_dict,
                                  context_instance=RequestContext(request))
Esempio n. 4
0
def analysis_results(request, project_id=None, questionnaire_code=None):
    manager = get_database_manager(request.user)


    org_id = helper.get_org_id_by_user(request.user)

    if request.method == 'GET':
        questionnaire = Project.get(manager, project_id)
        dashboard_page = settings.HOME_PAGE + "?deleted=true"
        if questionnaire.is_void():
            return HttpResponseRedirect(dashboard_page)

        filterable_fields = _get_filterable_fields(questionnaire)
        first_filterable_fields = filterable_fields.pop(0) if filterable_fields else None

        result_dict = {
            "is_quota_reached": is_quota_reached(request, org_id=org_id),
            "first_filterable_field": first_filterable_fields,
            "filterable_fields": filterable_fields
            }
        result_dict.update(project_info(request, questionnaire, questionnaire_code))
        return render_to_response('project/analysis_results.html', result_dict,
                                  context_instance=RequestContext(request))