Browse Source

Fix file name in file_not_exists

master
venkataakhil 1 year ago
parent
commit
979adbe405
  1. 8
      smart_service/apis/master_api.py

8
smart_service/apis/master_api.py

@ -435,12 +435,12 @@ def change_file_dir():
def file_not_exists():
file_data = frappe.db.sql('''
select parent,step_name,file from tabProcedure_Details where content_type = 'File' order by parent; ;''', as_dict=1)
select parent,step_name,file,name from tabProcedure_Details where content_type = 'File' order by parent; ;''', as_dict=1)
changed_file_list = []
for d in file_data:
path = d['file']
isExist = os.path.exists(base_path + path)
@ -460,7 +460,7 @@ def remove_extra_spaces_in_file_path():
file_path_not_exists = base_path + "/files/json_files/1.json"
with open(file_path_not_exists, 'r') as outfile:
data = json.load(outfile)
for d in data:
res_str = re.sub("/files/ /", "/files/", d['file'])
res_str = re.sub("/files/ ", "/files/", res_str)
@ -468,4 +468,4 @@ def remove_extra_spaces_in_file_path():
frappe.db.sql(f'''
update tabProcedure_Details set file = '{res_str}' where name = '{d['name']}';
''')
frappe.db.commit()
frappe.db.commit()

Loading…
Cancel
Save