def get_aggregate_list(header_list, post_data): aggregates = [] for index, field_name in enumerate(header_list): aggregates.append( aggregate_module.aggregation_factory( post_data[index].strip().lower(), field_name)) return aggregates
def _load_data(form_model, manager, questionnaire_code, request): header_list = helper.get_headers(form_model.fields) aggregation_type_list = json.loads(request.POST.get("aggregation-types")) start_time = helper.get_formatted_time_string(request.POST.get("start_time").strip() + START_OF_DAY) end_time = helper.get_formatted_time_string(request.POST.get("end_time").strip() + END_OF_DAY) aggregates = helper.get_aggregate_list(header_list[1:], aggregation_type_list) aggregates = [aggregate_module.aggregation_factory("latest", form_model.fields[0].name)] + aggregates data_dictionary = aggregate_module.aggregate_by_form_code_python(manager, questionnaire_code, aggregates=aggregates, starttime=start_time, endtime=end_time) return data_dictionary
def _load_data(form_model, manager, questionnaire_code, request): header_list = helper.get_headers(form_model.fields) aggregation_type_list = json.loads(request.POST.get("aggregation-types")) start_time = helper.get_formatted_time_string( request.POST.get("start_time").strip() + START_OF_DAY) end_time = helper.get_formatted_time_string( request.POST.get("end_time").strip() + END_OF_DAY) aggregates = helper.get_aggregate_list(header_list[1:], aggregation_type_list) aggregates = [ aggregate_module.aggregation_factory("latest", form_model.fields[0].name) ] + aggregates data_dictionary = aggregate_module.aggregate_by_form_code_python( manager, questionnaire_code, aggregates=aggregates, starttime=start_time, endtime=end_time) return data_dictionary