Browse Source

variant asset idx

master
Ubuntu 3 years ago
parent
commit
1556ed43e3
  1. 13
      smart_service/apis/update_validation.py

13
smart_service/apis/update_validation.py

@ -38,7 +38,6 @@ def check_all_vehicle_updates(vehicle_list):
if publish_type[0][0] != None:
for v in vehicle_data:
v_id = v['Vehicle']
current_version = float(v['CurrentVersion'])
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, v_id,lang, publish_type[0][0]),as_dict=True)
@ -109,7 +108,6 @@ def check_vehicle_update(vehicle_list):
publish_docs = frappe.db.get_list('Publish_Docs', filters={'parent': d['name']},
fields=['variant_mapping', 'system', 'sub_system',
'procedure_link', 'procedure_status'])
if publish_docs != None:
list1.append(publish_docs)
for d in list1:
@ -149,7 +147,6 @@ def check_vehicle_update(vehicle_list):
temp_dict[j] = temp_sub
temp_set[i] = temp_dict
procedure[d] = temp_set
appendList.append(procedure)
for g in appendList:
@ -168,7 +165,7 @@ def check_vehicle_update(vehicle_list):
current_db_name, d), as_dict=True)
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';''' % (
'''SELECT category, attach_file as file, %s,idx as variant_asset_idx FROM %s.`tabVariant Mapping_Assets` where category<>'Technical Manual' and parent='%s' and language='%s';''' % (
active_status_case, current_db_name, d, l_id), as_dict=True)
vari = vari[0]
@ -217,8 +214,6 @@ def check_vehicle_update(vehicle_list):
kms = frappe.db.sql(
'''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM {}.`tabKilometer Mapping_Items` where sub_systems='{}'
and parent Like '{}' and substring(parent,-5,2) = '{}' order by kilometer_IDX;'''.format(current_db_name, j, d+"%",l_id), as_dict=True)
subsys['Config Kilometer'] = kms
for k in appendDict[d][i][j]:
@ -278,7 +273,6 @@ def check_vehicle_update(vehicle_list):
{'Language': l_id, 'IsUpdateAvailable': 'false', 'CurrentVersion': float(current_version)})
response['Vehicle'] = vehicle
response['VehicleReqList'] = Vehicle_req_list
return response
else:
@ -288,19 +282,18 @@ def check_vehicle_update(vehicle_list):
response['JSON'] = {"Error":"Input Error"}
return response
@frappe.whitelist()
def update_completed(FileName):
try:
os.remove(base_url+FileName)
return {'isSuccessful':True}
except:
return {'isSuccessful':False}
@frappe.whitelist()
def delete_complete(doc=None,method=None):
site_name = cstr(frappe.local.site)
base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public"
path = base_url+'/files/json_files/temp1/'
@ -310,7 +303,6 @@ def delete_complete(doc=None,method=None):
os.remove(str(path) + str(file))
@frappe.whitelist()
def file_details():
lst=[]
@ -318,5 +310,4 @@ def file_details():
for entry in dir_entries:
info = entry.stat()
lst.append(info)
return lst
Loading…
Cancel
Save