def permit_hgain(): global all_names_servicios servicios_nus = request.form.getlist("check") avg_time = [] ed_num = [] ing_num = [] ratio = [] light = [[],[],[],[]] if servicios_nus: this_sid_list = servicios_nus select_names_servicios = [] else: this_sid_list = sid_list all_names_servicios = [] for item in this_sid_list: temp = get_gps_data(item, 999) if temp[0] == 0 or temp[1] == 0 or temp[2] == 0: () else: avg_time.append(temp[0]) ed_num.append(temp[1]) ing_num.append(temp[2]) ratio.append(temp[5]) cvt_light(light,(temp[5])) if servicios_nus: select_names_servicios.append([get_servicio_numbre_list(item), item]) else: all_names_servicios.append([get_servicio_numbre_list(item), item]) if not servicios_nus: select_names_servicios = all_names_servicios return render_template("permiso/home.html", send_all_numbre=all_names_servicios, send_select_numbre=select_names_servicios, send_avg_time=avg_time, send_ed_num=ed_num, send_ing_num=ing_num, send_ratio=ratio, send_light=light)
def get_rank_data(x): global all_names_servicios servicios_nus = x if servicios_nus: this_sid_list = servicios_nus select_names_servicios = [] else: this_sid_list = sid_list_no_sea all_names_servicios = [] avg_time = [] ed_num = [] ing_num = [] ratio = [] illegal_days = [] inv = [] # this_sid_list.remove(11) # here i want to exclude SEA (with sid 11) from the ranking here for item in this_sid_list: temp = get_gps_data(item, 999) if temp[0] == 0 or temp[1] == 0 or temp[2] == 0: () else: avg_time.append(temp[0]) ed_num.append(temp[1]) ing_num.append(temp[2]) ratio.append(temp[5]) illegal_days.append(temp[6]) inv.append(inv_block(item)) if servicios_nus: select_names_servicios.append([get_servicio_numbre_list(item), item]) else: all_names_servicios.append([get_servicio_numbre_list(item), item]) if not servicios_nus: select_names_servicios = all_names_servicios return ([all_names_servicios, select_names_servicios, avg_time, ed_num, ing_num, ratio, illegal_days, inv])
def servicio_home(): global all_names_servicios inv = [] servicios_nus = request.form.getlist("check") if servicios_nus: this_sid_list = servicios_nus select_names_servicios = [] else: this_sid_list = sid_list all_names_servicios = [] for item in this_sid_list: if inv_block(item) != 0: inv.append(inv_block(item)) if servicios_nus: select_names_servicios.append([get_servicio_numbre_list(item), item]) else: all_names_servicios.append([get_servicio_numbre_list(item), item]) if not servicios_nus: select_names_servicios = all_names_servicios return render_template("servicio/home.html", send_all_numbre=all_names_servicios, send_select_numbre=select_names_servicios, send_inv=inv)
def permit_per_office(): avg_time = [] ed_num = [] ing_num = [] name = [] ratio = [] for item in sid_list: temp = get_gps_data(item, 999) if temp[0] == 0 or temp[1] == 0 or temp[2] == 0: () else: avg_time.append(temp[0]) ed_num.append(temp[1]) ing_num.append(temp[2]) name.append(get_servicio_numbre_list(item)) ratio.append(temp[5]) else: return render_template("permiso/per_office.html", send_numbre=name, send_avg_time=avg_time, send_ed_num=ed_num, send_ing_num=ing_num, send_ratio = ratio)
def refresh_website(): global time_now, time_now_nomicro, year_2dig, month_2dig, servicio_nu, servicio_id, permiso_nu, permiso_id, permit_dataset, servicio_numbre_list, all_names_permisos, all_names_servicios, permiso_light_list, super_light_list, alineacion_light_list time_now = datetime.now() time_now_nomicro = datetime.now().strftime("%Y-%m-%d %H:%M:%S") year_2dig = int((str(time_now.year))[2:4]) month_2dig = time_now.month servicio_nu = 1 servicio_id = 1 permiso_nu = 1 permiso_id = 1 permit_dataset = [0, 0, 0] servicio_numbre_list = get_servicio_numbre_list(999) all_names_permisos = [] all_names_servicios = [] permiso_light_list = [] super_light_list = [] alineacion_light_list = []
def permit_p_numbre(): keyword = (request.args.get('keyword')) permiso_nu = (seperate(keyword))[1] servicio_id = (seperate(keyword))[0] servicio_nu = get_servicio_numbre_list(servicio_id) permiso_id = find_permiso_id(permiso_nu, servicio_id) gps_data = get_gps_data(1, permiso_id) avg_time = gps_data[0] done_num = gps_data[1] ing_num = gps_data[2] noinput_num = gps_data[3] legal_time = get_legal_data(1, permiso_id) ### i think there is a big problem here permit_dataset = [avg_time, get_sin_gps(servicio_id,permiso_id)] if get_sin_gps(servicio_id,permiso_id) == 0: saved_time = 0 else: saved_time = round(100*(get_sin_gps(servicio_id,permiso_id) - avg_time) / (get_sin_gps(servicio_id,permiso_id))) return render_template("permiso/permiso_result.html", send_servicio_numbre_lists=servicio_numbre_list, send_permit_dataset=permit_dataset, send_servicio_nu=servicio_nu, send_servicio_ids=servicio_id, send_permiso_nu=permiso_nu, send_permiso_ids=permiso_id, send_avg_time=avg_time, send_done_num=done_num, get_ing_num=ing_num, send_noinput_num=noinput_num, send_legal_time=legal_time, send_saved_time=saved_time)
def home(): global permiso_light_list, super_light_list, alineacion_light_list permiso_light_list = [] super_light_list = [] alineacion_light_list = (get_alineacion_all(1))[0] # for all the permits for item in sid_list: temp = get_gps_data(item, 999) if temp[0] == 0 or temp[1] == 0 or temp[2] == 0: () else: permiso_light_list.append([((get_servicio_numbre_list(item))), cvt_light_easier(temp[5]), str(item)]) # for SUPER for item in sid_list: temp = get_super_servicio(item,1) if temp[1] == 0: () else: super_light_list.append(temp) return render_template("home.html", send1s=permiso_light_list, send2s=super_light_list, send3s=alineacion_light_list)
# here I am defining some global variables time_now = datetime.now() time_now_nomicro = datetime.now().strftime("%Y-%m-%d %H:%M:%S") year_2dig = int((str(time_now.year))[2:4]) month_2dig = time_now.month user_id = 1 servicio_nu = 1 servicio_id = 1 permiso_nu = 1 permiso_id = 1 permit_dataset = [0, 0, 0] servicio_numbre_list = get_servicio_numbre_list(999) all_names_permisos = [] all_names_servicios = [] permiso_light_list = [] super_light_list = [] alineacion_light_list = [] def refresh_website(): global time_now, time_now_nomicro, year_2dig, month_2dig, servicio_nu, servicio_id, permiso_nu, permiso_id, permit_dataset, servicio_numbre_list, all_names_permisos, all_names_servicios, permiso_light_list, super_light_list, alineacion_light_list time_now = datetime.now() time_now_nomicro = datetime.now().strftime("%Y-%m-%d %H:%M:%S") year_2dig = int((str(time_now.year))[2:4]) month_2dig = time_now.month