def process_get_service_providers(db, request, session_user): service_provider_list = get_service_provider_details_list(db) current_date_time = get_date_time_in_date() str_current_date_time = datetime_to_string_time(current_date_time) return clientmasters.GetServiceProvidersSuccess( service_providers=service_provider_list, current_date=str_current_date_time)
def check_and_update_login_attempt(db, user_id): current_date_time = get_date_time_in_date() rows = get_login_attempt_and_time(db, user_id) if (rows): last_login_time = rows[0]["login_time"] diff = relativedelta.relativedelta(current_date_time, last_login_time) if diff.hours > 2 or diff.days > 0: db.update(tblUserLoginHistory, ["login_attempt"], [0, user_id], " user_id=%s ")
def upload_completed_task_current_year_csv(db, request_frame, session_user): if request_frame.csv_size > 0: pass # save csv file csv_name = convert_base64_to_file(BULKUPLOAD_CSV_PATH, request_frame.csv_name, request_frame.csv_data) # read data from csv file header, completed_task_data = read_data_from_csv(csv_name) # csv data validation cObj = ValidateCompletedTaskCurrentYearCsvData(db, completed_task_data, session_user, request_frame.csv_name, header) # print "request_frame.legal_entity_id>>", request_frame.legal_entity_id res_data = cObj.perform_validation(request_frame.legal_entity_id) if res_data is False: return bu_ct.InvalidCsvFile() elif res_data["return_status"] is True: current_date_time = get_date_time_in_date() str_current_date_time = datetime_to_string(current_date_time) unit_id = res_data["unit_id"] domain_id = res_data["domain_id"] client_id, client_group_name = get_client_id_by_le( db, request_frame.legal_entity_id) csv_args = [ client_id, request_frame.legal_entity_id, domain_id, unit_id, client_group_name, csv_name, session_user, str_current_date_time, res_data["total"], res_data["doc_count"], "0", "0" ] new_csv_id = save_completed_task_current_year_csv( db, csv_args, session_user) if new_csv_id: if save_completed_task_data(db, new_csv_id, res_data["data"], client_id) is True: result = bu_ct.UploadCompletedTaskCurrentYearCSVSuccess( res_data["total"], res_data["valid"], res_data["invalid"], new_csv_id, csv_name, res_data["doc_count"], res_data["doc_names"], unit_id, domain_id) # csv data save to temp db else: result = bu_ct.UploadCompletedTaskCurrentYearCSVFailed( res_data["invalid_file"], res_data["mandatory_error"], res_data["max_length_error"], res_data["duplicate_error"], res_data["invalid_char_error"], res_data["invalid_data_error"], res_data["inactive_error"], res_data["total"], res_data["invalid"], res_data["invalid_file_format"], res_data["invalid_date"]) return result
def process_get_on_occurrence_compliances(db, request, session_user): unit_id = request.unit_id to_count = RECORD_DISPLAY_COUNT user_domain_ids = get_user_domains(db, session_user) user_unit_ids = get_user_unit_ids(db, session_user) compliances = get_on_occurrence_compliances_for_user( db, session_user, user_domain_ids, user_unit_ids, unit_id, request.start_count, to_count) total_count = get_on_occurrence_compliance_count(db, session_user, user_domain_ids, user_unit_ids, unit_id) current_date_time = get_date_time_in_date() str_current_date_time = datetime_to_string_time(current_date_time) return clientuser.GetOnOccurrenceCompliancesSuccess( compliances=compliances, current_date=str_current_date_time, total_count=total_count)
def process_get_current_compliance_detail(db, request, session_user): unit_id = request.unit_id current_start_count = request.current_start_count cal_view = request.cal_view cal_date = request.cal_date to_count = RECORD_DISPLAY_COUNT current_compliances_list = get_current_compliances_list( db, unit_id, current_start_count, to_count, session_user, cal_view, cal_date) current_date_time = get_date_time_in_date() str_current_date_time = datetime_to_string_time(current_date_time) inprogress_count = get_inprogress_count(db, session_user, unit_id, cal_view, cal_date) overdue_count = get_overdue_count(db, session_user, unit_id, cal_view, cal_date) return clientuser.GetCurrentComplianceDetailSuccess( current_compliances=current_compliances_list, current_date=str_current_date_time, overdue_count=overdue_count, inprogress_count=inprogress_count)
def process_get_compliance_approval_list(db, request, session_user): unit_id = request.unit_id to_count = RECORD_DISPLAY_COUNT compliance_approval_list, count = get_compliance_approval_list( db, unit_id, request.start_count, to_count, session_user ) total_count = get_compliance_approval_count(db, session_user, unit_id) approval_status = [ clientcore.COMPLIANCE_APPROVAL_STATUS("Concur"), clientcore.COMPLIANCE_APPROVAL_STATUS("Reject Concurrence"), clientcore.COMPLIANCE_APPROVAL_STATUS("Approve"), clientcore.COMPLIANCE_APPROVAL_STATUS("Reject Approval"), clientcore.COMPLIANCE_APPROVAL_STATUS("Rectify Concurrence"), clientcore.COMPLIANCE_APPROVAL_STATUS("Rectify Approval") ] current_date_time = get_date_time_in_date() str_current_date_time = datetime_to_string_time(current_date_time) return clienttransactions.GetComplianceApprovalListSuccess( approval_list=compliance_approval_list, approval_status=approval_status, current_date=str_current_date_time, total_count=total_count )