Browse Source

Generate publish method- Test file path

master
venkataakhil 1 year ago
parent
commit
724e568aa5
  1. 14
      smart_service/apis/publish_api.py

14
smart_service/apis/publish_api.py

@ -497,6 +497,10 @@ 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)
frappe.log_error('old_json_path', str(prev_full_update_file))
frappe.log_error('new_json_path', str(file_name))
frappe.log_error('out_file_path', str(full_update_file_name))
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)
@ -555,11 +559,10 @@ def new_publish(args, publish_type, vehicle, language, version):
return False, "File save issue" return False, "File save issue"
else: else:
frappe.log_error(str('first time ionternal')) # frappe.log_error(str('first time internal'))
full_update_file_name = full_update_path_internal + vehicle + "/" + \ full_update_file_name = full_update_path_internal + vehicle + "/" + \
"%s-%s-full_v%s.json" % (vehicle, language, version) "%s-%s-full_v%s.json" % (vehicle, language, version)
if str(version) == "0.01": if str(version) == "0.01":
frappe.log_error(str('first time ionternal file creation'))
with open(full_update_file_name, "w") as outfile: with open(full_update_file_name, "w") as outfile:
outfile.write(json.dumps(json_file)) outfile.write(json.dumps(json_file))
get_step_total_count(full_update_file_name) get_step_total_count(full_update_file_name)
@ -571,6 +574,9 @@ def new_publish(args, publish_type, vehicle, language, version):
prev_full_update_file = full_update_path_internal + vehicle + "/" + \ prev_full_update_file = full_update_path_internal + vehicle + "/" + \
"%s-%s-full_v%s.json" % (vehicle, "%s-%s-full_v%s.json" % (vehicle,
language, prev_update_ver) language, prev_update_ver)
frappe.log_error('old_json_path', str(prev_full_update_file))
frappe.log_error('new_json_path', str(file_name))
frappe.log_error('out_file_path', str(full_update_file_name))
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)
@ -581,7 +587,7 @@ def new_publish(args, publish_type, vehicle, language, version):
return True, file_name.split("public")[1] return True, file_name.split("public")[1]
# return True, file_name # return True, file_name
else: else:
return False, "File save issue" return False, final_update_file
set_publish_flag(publish_type, vehicle, language) set_publish_flag(publish_type, vehicle, language)
frappe.log_error('file_name' + str(file_name)) frappe.log_error('file_name' + str(file_name))
@ -644,7 +650,7 @@ def set_publish_flag(publish_type, vehicle, language):
except Exception as e: except Exception as e:
frappe.log_error('set_publish_flag' + str(e)) frappe.log_error('set_publish_flag' + str(e))
@frappe.whitelist(allow_guest=1)
def merge_json_files(old_json_path, new_json_path, out_file_path): def merge_json_files(old_json_path, new_json_path, out_file_path):
try: try:
final_data = {"JSON": []} final_data = {"JSON": []}

Loading…
Cancel
Save