Browse Source

Replace double starappend content data to json file

master
venkataakhil 2 years ago
parent
commit
6bbbf74a74
  1. 12
      smart_service/apis/master_api.py

12
smart_service/apis/master_api.py

@ -485,7 +485,7 @@ def change_star_data():
select count(*) from tabProcedure_Details where content like '%**%'; select count(*) from tabProcedure_Details where content like '%**%';
''', as_dict=1) ''', as_dict=1)
print(count) print(count)
updated_list = []
data = frappe.db.sql(''' data = frappe.db.sql('''
select content_type,content,name,parent,replace(content,'**','abcxyz ') as new_content from tabProcedure_Details where content like '%**%'; select content_type,content,name,parent,replace(content,'**','abcxyz ') as new_content from tabProcedure_Details where content like '%**%';
''', as_dict=1) ''', as_dict=1)
@ -504,4 +504,12 @@ def change_star_data():
FLAG = 0 FLAG = 0
frappe.db.sql( frappe.db.sql(
f'''update tabProcedure_Details set content = '{sts}' where name = '{v['name']}'; ''') f'''update tabProcedure_Details set content = '{sts}' where name = '{v['name']}'; ''')
return data v['new_content'] = sts
updated_list.append(v)
content_file = base_path + "/files/json_files/content_update.json"
with open(content_file, 'w') as outfile:
try:
outfile.write(json.dumps(updated_list))
except:
pass
return content_file
Loading…
Cancel
Save