Browse Source

Publish new flow with step n total count

master
Ubuntu 2 years ago
parent
commit
74f32b38ae
  1. 160
      smart_service/apis/publish_api.py
  2. 256
      smart_service/apis/update_validation.py

160
smart_service/apis/publish_api.py

@ -96,6 +96,7 @@ def json_grouping(args, language):
active_status_case = "CASE WHEN active_status = 'Active' THEN 'True' ELSE 'False' END AS active_status"
for d in variant:
total_count = 0
variant_out = {}
vari = frappe.db.sql('''SELECT name,variant, vehicle,family_code,vehicle_segment,fuel,transmission,drive, active_status
FROM %s.`tabVariant Mapping` WHERE name ='%s' ; ''' % (current_db_name, d),
@ -104,7 +105,7 @@ def json_grouping(args, language):
var_asset = frappe.db.sql(
'''SELECT category, attach_file as file, %s FROM %s.`tabVariant Mapping_Assets` where category<>'Technical Manual' and parent='%s' and language='%s';''' % (
active_status_case, current_db_name, d, lang['language']), as_dict=True)
vari = vari[0]
if vari['active_status'] == 'Active':
@ -125,8 +126,10 @@ def json_grouping(args, language):
vari.update({'kms_mapping_active_status': kms_active_status})
vari['Assets'] = var_asset
variant_out['Variant'] = vari
total_count += len(var_asset)
# total_count += len(variant[d]) - 1
system_out = []
for i in system[d]:
if i != None:
@ -143,7 +146,9 @@ def json_grouping(args, language):
sysassets = frappe.db.sql(
'''SELECT idx as systemdisplayorder, system_asset,active_status FROM {3}.`tabSystem Mapping_System Assets` where parent like '{0}%' and language='{1}' and systems='{2}';'''.format(
d, lang['language'], i, current_db_name), as_dict=True)
total_count += len(sysassets)
# total_count += len(system[d][i])
for sysasset in sysassets:
if sysasset['active_status'] == 'Active':
sysasset['active_status'] = True
@ -169,7 +174,7 @@ def json_grouping(args, language):
kms = frappe.db.sql(
'''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM %s.`tabKilometer Mapping_Items` where sub_systems='%s' and parent LIKE '%s' order by kilometer_IDX;''' % (
current_db_name, j, varKMS), as_dict=True)
total_count += len(kms)
subsys['Config Kilometer'] = kms
for k in docs_child:
if k['variant_mapping'] == d and k['system'] == i and k['sub_system'] == j:
@ -178,7 +183,7 @@ def json_grouping(args, language):
current_db_name, k['procedure_link']), as_dict=True)
proc_data = get_parent_map(
proc_details, 'procedure_name')
total_count += len(proc_data)
k['Procedure_details'] = proc_data
subsys['procedure_status'] = k['procedure_status']
subsys['procedure_link'] = k['procedure_link']
@ -195,6 +200,7 @@ def json_grouping(args, language):
sys['Subsystems'] = subsystem_out
system_out.append(sys)
variant_out['StepCount'] = count
variant_out['TotalCount'] = total_count + count
variant_out['Variant']['Systems'] = system_out
final.append(variant_out)
@ -211,73 +217,69 @@ def print(sts):
@frappe.whitelist(allow_guest=True)
def new_publish(args, publish_type, vehicle, language, version):
# Create Directory for internal,global and full_update publish
try:
if not os.path.exists(internal_path + vehicle + '/'):
os.makedirs(internal_path + vehicle + '/')
if not os.path.exists(global_path + vehicle + '/'):
os.makedirs(global_path + vehicle + '/')
if not os.path.exists(full_update_path + vehicle + '/'):
os.makedirs(full_update_path + vehicle + '/')
except Exception as e:
return {"status": 0, "error": "Failed to create Folders"}
#JSON generation
json_file = json_grouping(args,language)
file_name = '%s-%s_v%s.json' % (vehicle, language, version)
# File name generation
if publish_type.lower() == 'internal':
file_name = internal_path + vehicle + '/' + file_name
elif publish_type.lower() == 'global':
file_name = global_path + vehicle + '/' + file_name
else:
return {"status": 0, 'error': 'Publish type not available'}
# Save file (Internal/Global)
with open(file_name, 'w') as outfile:
outfile.write(json.dumps(json_file))
# Remove previous internal publish file
if publish_type.lower() == 'internal':
for fil in os.listdir(internal_path + vehicle):
file_val = internal_path + vehicle + '/' + fil
if file_val != file_name:
if (fil.split('-')[1]).split('_')[0] == language:
os.remove(file_val)
# Generate full update file
pub_ver = None
prev_update_ver = None
if publish_type.lower() == 'global':
pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,version,publish_type FROM tabPublish where vehicle = '{}'
and publish_type = 'Global' AND `language` = '{}' order by version desc limit 1 ;'''.format(vehicle,language),as_dict=True)
if pub_ver:
prev_update_ver = pub_ver[0]['version']
full_update_file_name = full_update_path + vehicle + '/'+ '%s-%s-full_v%s.json' % (vehicle, language, version)
# Since full update is not available for Global version 1
if version == '1.00':
with open(full_update_file_name, 'w') as outfile:
outfile.write(json.dumps(json_file))
return full_update_file_name
list1 = []
try:
try:
if not os.path.exists(internal_path + vehicle + '/'):
os.makedirs(internal_path + vehicle + '/')
if not os.path.exists(global_path + vehicle + '/'):
os.makedirs(global_path + vehicle + '/')
if not os.path.exists(full_update_path + vehicle + '/'):
os.makedirs(full_update_path + vehicle + '/')
except Exception as e:
return {"status": 0, "error": "Failed to create Folders"}
#JSON generation
json_file = json_grouping(args,language)
file_name = '%s-%s_v%s.json' % (vehicle, language, version)
# File name generation
if publish_type.lower() == 'internal':
file_name = internal_path + vehicle + '/' + file_name
elif publish_type.lower() == 'global':
file_name = global_path + vehicle + '/' + file_name
else:
prev_full_update_file = full_update_path + vehicle + '/'+ '%s-%s-full_v%s.json' % (vehicle, language, prev_update_ver)
final_update_file = merge_json_files(prev_full_update_file,file_name,full_update_file_name)
# Need to remove other full update files
# for fil in os.listdir(full_update_path + vehicle):
# file_val = full_update_path + vehicle + '/' + fil
# if file_val != final_update_file:
# if (fil.split('-')[1]).split('_')[0] == language:
# Remove prev full update files
# os.remove(file_val)
return final_update_file
return {"status": 0, 'error': 'Publish type not available'}
# Save file (Internal/Global)
with open(file_name, 'w') as outfile:
outfile.write(json.dumps(json_file))
# Remove previous internal publish file
if publish_type.lower() == 'internal':
for fil in os.listdir(internal_path + vehicle):
file_val = internal_path + vehicle + '/' + fil
if file_val != file_name:
if (fil.split('-')[1]).split('_')[0] == language:
os.remove(file_val)
# Generate full update file
pub_ver = None
prev_update_ver = None
if publish_type.lower() == 'global':
pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,version,publish_type FROM tabPublish where vehicle = '{}'
and publish_type = 'Global' AND `language` = '{}' order by version desc limit 2 ;'''.format(vehicle,language),as_dict=True)
if pub_ver:
prev_update_ver = pub_ver[1]['version']
full_update_file_name = full_update_path + vehicle + '/'+ '%s-%s-full_v%s.json' % (vehicle, language, version)
# Since full update is not available for Global version 1
if version == '1.00':
with open(full_update_file_name, 'w') as outfile:
outfile.write(json.dumps(json_file))
# return full_update_file_name
else:
prev_full_update_file = full_update_path + vehicle + '/'+ '%s-%s-full_v%s.json' % (vehicle, language, prev_update_ver)
list1.append(prev_full_update_file)
list1.append(file_name)
list1.append(full_update_file_name)
final_update_file = merge_json_files(prev_full_update_file,file_name,full_update_file_name)
return file_name.split('public')[1],list1
except:
return "Failed to save file"
@frappe.whitelist(allow_guest=True)
def new_update(vehicle_list=None):
@ -392,8 +394,8 @@ def merge_json_files(old_json_path,new_json_path,out_file_path):
for old_sub_system in old_system['Subsystems']:
if old_sub_system['sub_systems']==subsystem['sub_systems']:
for old_ck in old_sub_system['Config Kilometer']:
conf_km_name.add(old_ck['kilometer_name'])
if old_ck['kilometer_name'] not in conf_km_added and old_ck['kilometer_name'] in conf_km_name:
conf_km_name.add(old_ck['kilometer_name'])
sub_system_list.append(old_ck)
conf_km_added.add(old_ck['kilometer_name'])
proc_det_name=set()
@ -414,8 +416,8 @@ def merge_json_files(old_json_path,new_json_path,out_file_path):
for old_sub_system in old_system['Subsystems']:
if old_sub_system['sub_systems']==subsystem['sub_systems']:
for old_pd in old_sub_system['Procedure_details']:
proc_det_name.add(old_pd['kilometer_name'])
if old_pd['procedure_name'] not in proc_det_added and old_pd['procedure_name'] in proc_det_name:
proc_det_name.add(old_pd['kilometer_name'])
sub_system_list.append(old_pd)
proc_det_added.add(old_pd['kilometer_name'])
sub_system_list.append({"subSystemdisplayorder": subsystem['subSystemdisplayorder'],
@ -440,27 +442,27 @@ def merge_json_files(old_json_path,new_json_path,out_file_path):
for old_system in old_variants['Variant']['Systems']:
if old_system['system_name']==system['system_name']:
for old_sub_system in old_system['Subsystems']:
sub_system_name.add(old_sub_system['sub_systems'])
if old_sub_system['sub_systems'] not in sub_system_added and old_sub_system['sub_systems'] in sub_system_name:
sub_system_name.add(old_sub_system['sub_systems'])
sub_system_list.append(old_sub_system)
sub_system_added.add(old_sub_system['sub_systems'])
for asset in system['Assets']:
sub_system_name.add(asset['system_asset'])
system_asset_name.add(asset['system_asset'])
if asset['system_asset'] not in system_asset_added and asset['system_asset'] in system_asset_name:
system_asset_list.append({"system_asset": asset['system_asset'],
"systemdisplayorder": asset['systemdisplayorder'],
"active_status": asset['active_status'],
})
sub_system_added.add(asset['system_asset'])
system_asset_added.add(asset['system_asset'])
for old_variants in data_old['JSON']:
if old_variants['Variant']['name']==variant_new['Variant']['name']:
for old_system in old_variants['Variant']['Systems']:
if old_system['system_name']==system['system_name']:
for old_system_asset in old_system['Assets']:
system_asset_name.add(old_system_asset['system_asset'])
if old_system_asset['system_asset'] not in system_asset_added and old_system_asset['system_asset'] in system_asset_name:
sub_system_name.add(old_system_asset['system_asset'])
sub_system_list.append(old_system_asset)
sub_system_added.add(old_system_asset['system_asset'])
system_asset_list.append(old_system_asset)
system_asset_added.add(old_system_asset['system_asset'])
system_list.append({"systemdisplayorder": system['systemdisplayorder'],
"system_name": system['system_name'],
"icon_file": system['icon_file'],
@ -468,7 +470,7 @@ def merge_json_files(old_json_path,new_json_path,out_file_path):
"active_status": system['active_status'],
"Assets": system_asset_list,
"Subsystems":sub_system_list,
"conf_km_list":conf_km_list,
"Config Kilometer":conf_km_list,
})
system_added.add(system['system_name'])
except:
@ -508,8 +510,8 @@ def merge_json_files(old_json_path,new_json_path,out_file_path):
with open(out_file_path, "w") as outfile:
outfile.write(json_object)
return out_file_path
except:
return 'Failed to merge json'
except Exception as e :
return e
# def get_data(args):
# try:

256
smart_service/apis/update_validation.py

@ -64,6 +64,7 @@ def check_all_vehicle_updates(vehicle_list=None):
data = frappe.db.sql('''SELECT name,max(version) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='Global' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(
current_db_name, v_id, lang, current_version), as_dict=True)
elif current_version == float(data1_global[0]['version']):
if current_version < float(data1[0]['version']):
data = frappe.db.sql('''SELECT name,max(version) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
@ -99,7 +100,6 @@ def check_all_vehicle_updates(vehicle_list=None):
@frappe.whitelist()
def check_vehicle_update(vehicle_list=None):
t1 = time.time()
if vehicle_list == None:
return {"status": 0, "error": "Parameter missing: Vehicle List"}
if vehicle_list:
@ -118,26 +118,24 @@ def check_vehicle_update(vehicle_list=None):
# Iterate on language
for v in vehicle_data:
l_id = v['LanguageID']
current_version = v['CurrentVersion']
current_version = float(v['CurrentVersion'])
data1_global = frappe.db.sql('''SELECT name,max(version) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='Global' and vehicle_status='Active' order by version ASC;'''.format(
current_db_name, vehicle, l_id), as_dict=True)
data1 = frappe.db.sql('''SELECT name,max(version) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' order by version ASC;'''.format(
current_db_name, vehicle, l_id, publish_type), as_dict=True)
# return data1
and vehicle_status='Active' order by version ASC;'''.format(
current_db_name, vehicle, l_id), as_dict=True)
if data1[0]['version'] is not None:
if current_version == float(data1[0]['version']):
data1[0]['IsUpdateAvailable'] = "false"
# try:
data={}
data['Language']=l_id
data['IsUpdateAvailable'] = 'false'
data['CurrentVersion'] = float(current_version)
# data_append.append(d)
Vehicle_req_list.append(data)
# except:
# pass
else:
if current_version < (float(data1_global[0]['version'])-1.00):
data = frappe.db.sql('''SELECT name as Name,max(version) as Version,vehicle_id as Vehicle,language as Language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
@ -147,26 +145,27 @@ def check_vehicle_update(vehicle_list=None):
for d in data:
try:
file_name="/files/json_files/full_update/"+vehicle+"/"+vehicle+"-"+d['Language']+"-"+"full_v"+str(d['Version'])+".json"
get_step_total_count(base_url+file_name,)
file_size = os.path.getsize(base_url + file_name)
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']= None
t2 = time.time()
d['time']=t2-t1
except:
file_name= None
file_size = None
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']='File failed to load'
t2 = time.time()
d['time']=t2-t1
d['IsUpdateAvailable'] = 'true'
d['CurrentVersion'] = float(current_version)
# data_append.append(d)
Vehicle_req_list.append(d)
except:
pass
except Exception as e:
Vehicle_req_list.append({"Error":e})
elif current_version == (float(data1_global[0]['version'])-1.00):
data = frappe.db.sql('''SELECT name as Name,max(version) as Version,vehicle_id as Vehicle,language as Language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='Global' and vehicle_status='Active' and Version > '{}' order by version ASC;'''.format(
@ -179,22 +178,20 @@ def check_vehicle_update(vehicle_list=None):
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']= None
t2 = time.time()
d['time']=t2-t1
except:
file_name= None
file_size = None
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']='File failed to load'
t2 = time.time()
d['time']=t2-t1
d['IsUpdateAvailable'] = 'true'
d['CurrentVersion'] = float(current_version)
# data_append.append(d)
Vehicle_req_list.append(d)
except:
pass
except Exception as e1:
Vehicle_req_list.append({"Error":e1})
elif current_version == float(data1_global[0]['version']):
if current_version < float(data1[0]['version']):
data = frappe.db.sql('''SELECT name as Name,max(version) as Version,vehicle_id as Vehicle,language as Language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
@ -208,22 +205,80 @@ def check_vehicle_update(vehicle_list=None):
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']= None
t2 = time.time()
d['time']=t2-t1
except:
file_name= None
file_size = None
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']='File failed to load'
t2 = time.time()
d['time']=t2-t1
d['IsUpdateAvailable'] = 'true'
d['CurrentVersion'] = float(current_version)
# data_append.append(d)
Vehicle_req_list.append(d)
except:
pass
except Exception as e2:
Vehicle_req_list.append({"Error":e2})
elif (float(data1_global[0]['version'])-1.00) < current_version < float(data1_global[0]['version']):
Vehicle_req_list.append({'Cur_ver':current_version,"Global Ver":data1[0]['version']})
if current_version < float(data1[0]['version']):
Vehicle_req_list.append({"loop":4.1})
data = frappe.db.sql('''SELECT name as Name,max(version) as Version,vehicle_id as Vehicle,language as Language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='Global' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(
current_db_name, vehicle, l_id, current_version), as_dict=True)
Vehicle_req_list.append({"Data":'Append'})
try:
for d in data:
try:
file_name="/files/json_files/global/"+vehicle+"/"+vehicle+"-"+d['Language']+"_v"+str(d['Version'])+".json"
file_size = os.path.getsize(base_url + file_name)
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']= None
except:
file_name= "/files/json_files/global/"+vehicle+"/"+vehicle+"-"+d['Language']+"_v"+str(d['Version'])+".json"
file_size = None
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']='File failed to load'
d['IsUpdateAvailable'] = 'true'
d['CurrentVersion'] = float(current_version)
Vehicle_req_list.append(d)
except Exception as e2:
Vehicle_req_list.append({"Error":e2})
# else:
# Vehicle_req_list.append({"error2":"Else"})
elif current_version > float(data1_global[0]['version']):
if current_version < float(data1[0]['version']):
data = frappe.db.sql('''SELECT name as Name,max(version) as Version,vehicle_id as Vehicle,language as Language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(
current_db_name, vehicle, l_id,publish_type, current_version), as_dict=True)
try:
for d in data:
try:
file_name="/files/json_files/internal/"+vehicle+"/"+vehicle+"-"+d['Language']+"_v"+str(d['Version'])+".json"
file_size = os.path.getsize(base_url + file_name)
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']= None
except:
file_name= "/files/json_files/internal/"+vehicle+"/"+vehicle+"-"+d['Language']+"_v"+str(d['Version'])+".json"
file_size = None
d['JsonURL']= file_name
d['FileSize']= file_size
d['Error']='File failed to load'
d['IsUpdateAvailable'] = 'true'
d['CurrentVersion'] = float(current_version)
Vehicle_req_list.append(d)
except Exception as e3:
Vehicle_req_list.append({'Error':e3})
# else:
# Vehicle_req_list.append({'Error':"Else 3"})
else:
Vehicle_req_list.append(
@ -239,9 +294,145 @@ def check_vehicle_update(vehicle_list=None):
return response
else:
return {"status": 0, "error": "Check Parameter: vehicle list"}
def get_step_total_count(json_path):
with open(json_path) as json_file:
data = json.load(json_file)
data = calculate_step(data)
data = calculate_total(data)
generate_json(data, json_path)
# return step_count, total_count
def generate_json(data, json_path):
json_object = json.dumps(data)
with open(json_path, "w") as outfile:
outfile.write(json_object)
def calculate_total(data):
total_count = 0
for variant in data['JSON']:
total_count += len(variant['Variant']['Assets'])
total_count += len(variant['Variant']['Systems'])
for system in variant['Variant']['Systems']:
total_count += len(system['Assets'])
total_count += len(system['Subsystems'])
for subsystem in system['Subsystems']:
try:
total_count += len(subsystem['Config Kilometer'])
except:
pass
try:
total_count += len(subsystem['Procedure_details'])
except:
pass
try:
for step in subsystem['Procedure_details']:
total_count += len(step['steps'])
except:
pass
variant['TotalCount'] = total_count
return data
def calculate_step(data):
step_count = 0
for variant in data['JSON']:
for system in variant['Variant']['Systems']:
for subsystem in system['Subsystems']:
try:
for procedure in subsystem['Procedure_details']:
step_count += len(procedure['steps'])
except:
pass
variant['StepCount'] = step_count
return data
@frappe.whitelist()
def check_vehicle_update11(vehicle_list=None):
if vehicle_list == None:
return {"status": 0, "error": "Parameter missing: Vehicle List"}
Vehicle_req_list = []
if vehicle_list:
response = {}
req_list = json.loads(vehicle_list)
response['Vehicle']=req_list['Vehicle']
vehicle = req_list['Vehicle']
iid = req_list['InstallationId']
vehicle_data = req_list['VehicleReqList']
publish_type = frappe.db.get_list('App Device', filters={'name': iid}, fields='publish_type')
if len(publish_type) > 0:
publish_type = publish_type[0]['publish_type']
# Iterate over language
if publish_type == 'Internal':
for v in vehicle_data:
global_ver = frappe.db.sql('''SELECT max(version) as version,publish_type as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}'
and language='{}' and publish_status='Published' and vehicle_status='Active' and publish_type = 'Global' ;'''.format(
current_db_name, vehicle, l_id), as_dict=True)
if global_ver:
global_pub_ver = global_pub_ver['version']
l_id = v['LanguageID']
cur_ver = v['CurrentVersion']
pub_ver = get_publish_ver(vehicle,l_id)
if cur_ver == pub_ver['version']:
Vehicle_req_list.append({'Language': l_id, 'IsUpdateAvailable': 'false',
'CurrentVersion': float(cur_ver)})
# Global File
else:
for v in vehicle_data:
l_id = v['LanguageID']
cur_ver = v['CurrentVersion']
global_pub = frappe.db.sql('''SELECT max(version) as version,publish_type, vehicle_id,language FROM {}.tabPublish where vehicle='{}'
and language='{}' and publish_status='Published' and vehicle_status='Active' and publish_type = 'Global' ;'''.format(
current_db_name, vehicle, l_id), as_dict=True)
if global_pub:
global_pub_ver1 = float(global_pub[0]['version'])
if global_pub_ver1 == cur_ver:
Vehicle_req_list.append({'Language': l_id, 'IsUpdateAvailable': 'false',
'CurrentVersion': float(cur_ver)})
else:
if cur_ver < global_pub_ver1:
if (global_pub_ver1 - cur_ver) > 1:
file_name="/files/json_files/full_update/"+vehicle+"/"+vehicle+"-"+ l_id +"-" + "full_v" + str(global_pub[0]['version'])+".json"
file_size = os.path.getsize(base_url + file_name)
Vehicle_req_list.append({'Version':global_pub_ver1,'Language': l_id, 'IsUpdateAvailable': 'true','JsonURL':file_name,'FileSize':file_size,
'Error':None,'CurrentVersion': float(cur_ver)})
else:
file_name="/files/json_files/global/"+vehicle+"/"+vehicle+"-"+ l_id + "_v" + str(global_pub[0]['version'])+".json"
file_size = os.path.getsize(base_url + file_name)
Vehicle_req_list.append({'Version':global_pub_ver1,'Language': l_id, 'IsUpdateAvailable': 'true','JsonURL':file_name,'FileSize':file_size,
'Error':None,'CurrentVersion': float(cur_ver)})
else:
Vehicle_req_list.append({'Language': l_id, 'IsUpdateAvailable': 'false',
'CurrentVersion': float(cur_ver)})
return Vehicle_req_list
def get_publish_ver(vehicle,l_id):
return frappe.db.sql('''SELECT max(version) as version,publish_type as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and
publish_status='Published' and vehicle_status='Active' ;'''.format(
current_db_name, vehicle, l_id), as_dict=True)
# @frappe.whitelist()
# def check_vehicle_update(vehicle_list=None):
# t1 = time.time()
# if vehicle_list == None:
# return {"status": 0, "error": "Parameter missing: Vehicle List"}
# if vehicle_list:
@ -474,8 +665,7 @@ def check_vehicle_update(vehicle_list=None):
# res['JsonURL'] = file_name
# res['FileSize'] = file_size
# res['Error'] = None
# t2 = time.time()
# res['time'] = t2-t1
# except:
# res['JsonURL'] = None

Loading…
Cancel
Save