|
@ -316,7 +316,7 @@ def new_publish(args, publish_type, vehicle, language, version): |
|
|
# get_step_total_count(full_update_file_name) |
|
|
# get_step_total_count(full_update_file_name) |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,version,publish_type FROM tabPublish where vehicle = '{}' |
|
|
pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,format(version,2) as 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) |
|
|
and publish_type = 'Global' AND `language` = '{}' order by version desc limit 2 ;'''.format(vehicle, language), as_dict=True) |
|
|
if pub_ver: |
|
|
if pub_ver: |
|
|
prev_update_ver = pub_ver[1]['version'] |
|
|
prev_update_ver = pub_ver[1]['version'] |
|
@ -324,11 +324,11 @@ def new_publish(args, publish_type, vehicle, language, version): |
|
|
'%s-%s-full_v%s.json' % (vehicle, |
|
|
'%s-%s-full_v%s.json' % (vehicle, |
|
|
language, prev_update_ver) |
|
|
language, prev_update_ver) |
|
|
# test_full_update_file_name = '/home/ubuntu/frappe-bench/sites/guidedsmartservice.com/public/files/json_files/full_update/XUV 0613/XUV 0613-en-full_update.json' |
|
|
# test_full_update_file_name = '/home/ubuntu/frappe-bench/sites/guidedsmartservice.com/public/files/json_files/full_update/XUV 0613/XUV 0613-en-full_update.json' |
|
|
file_flag, final_update_file = merge_json_files( |
|
|
# file_flag, final_update_file = merge_json_files( |
|
|
prev_full_update_file, file_name, full_update_file_name) |
|
|
# prev_full_update_file, file_name, full_update_file_name) |
|
|
# return prev_full_update_file, file_name, new_full_update_file_name |
|
|
# return prev_full_update_file, file_name, new_full_update_file_name |
|
|
# file_flag, final_update_file = new_merge_json_files( |
|
|
file_flag, final_update_file = new_merge_json_files( |
|
|
# prev_full_update_file, file_name, new_full_update_file_name) |
|
|
prev_full_update_file, file_name, full_update_file_name) |
|
|
return file_flag, final_update_file |
|
|
return file_flag, final_update_file |
|
|
|
|
|
|
|
|
return True, file_name.split('public')[1] |
|
|
return True, file_name.split('public')[1] |
|
@ -355,7 +355,6 @@ def merge_json_files(old_json_path, new_json_path, out_file_path): |
|
|
try: |
|
|
try: |
|
|
with open(old_json_path, 'r') as json_file: |
|
|
with open(old_json_path, 'r') as json_file: |
|
|
data_old = json.load(json_file) |
|
|
data_old = json.load(json_file) |
|
|
# return data_old |
|
|
|
|
|
with open(new_json_path, 'r') as json_file1: |
|
|
with open(new_json_path, 'r') as json_file1: |
|
|
data_new = json.load(json_file1) |
|
|
data_new = json.load(json_file1) |
|
|
|
|
|
|
|
@ -594,7 +593,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path): |
|
|
variant_asset_added = set() |
|
|
variant_asset_added = set() |
|
|
variant_asset_list = [] |
|
|
variant_asset_list = [] |
|
|
try: |
|
|
try: |
|
|
# variant_new['Variant']['Assets'] |
|
|
|
|
|
for variant_asset in variant_new['Variant']['Assets']: |
|
|
for variant_asset in variant_new['Variant']['Assets']: |
|
|
variant_asset_name.add(variant_asset['file']) |
|
|
variant_asset_name.add(variant_asset['file']) |
|
|
if variant_asset['file'] not in variant_asset_added and variant_asset[ |
|
|
if variant_asset['file'] not in variant_asset_added and variant_asset[ |
|
@ -604,7 +602,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path): |
|
|
except: |
|
|
except: |
|
|
pass |
|
|
pass |
|
|
try: |
|
|
try: |
|
|
# variant_new['Variant']['Systems'] |
|
|
|
|
|
for system in variant_new['Variant']['Systems']: |
|
|
for system in variant_new['Variant']['Systems']: |
|
|
system_asset_name = set() |
|
|
system_asset_name = set() |
|
|
system_asset_added = set() |
|
|
system_asset_added = set() |
|
@ -771,7 +768,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path): |
|
|
if variant_old['Variant']['name'] in variant_name and variant_old['Variant']['name'] not in variant_added: |
|
|
if variant_old['Variant']['name'] in variant_name and variant_old['Variant']['name'] not in variant_added: |
|
|
data_consolidated['JSON'].append({'Variant': variant_old['Variant'], |
|
|
data_consolidated['JSON'].append({'Variant': variant_old['Variant'], |
|
|
}) |
|
|
}) |
|
|
return True, data_consolidated |
|
|
|
|
|
json_object = json.dumps(data_consolidated) |
|
|
json_object = json.dumps(data_consolidated) |
|
|
with open(out_file_path, "w") as outfile: |
|
|
with open(out_file_path, "w") as outfile: |
|
|
outfile.write(json_object) |
|
|
outfile.write(json_object) |
|
@ -779,7 +775,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path): |
|
|
return True, out_file_path |
|
|
return True, out_file_path |
|
|
except Exception as e: |
|
|
except Exception as e: |
|
|
return False, frappe.get_traceback() |
|
|
return False, frappe.get_traceback() |
|
|
# return "Exception in publish" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@frappe.whitelist(allow_guest=True) |
|
|
@frappe.whitelist(allow_guest=True) |
|
|