|
|
@ -470,3 +470,38 @@ def remove_extra_spaces_in_file_path(): |
|
|
|
update tabProcedure_Details set file = '{res_str}' where name = '{d['name']}'; |
|
|
|
''') |
|
|
|
frappe.db.commit() |
|
|
|
|
|
|
|
|
|
|
|
def return_star_data(): |
|
|
|
data = frappe.db.sql(''' |
|
|
|
select content_type,content,name,parent,replace(content,'**','abcxyz ') as new_content from tabProcedure_Details ; |
|
|
|
''', as_dict=1) |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
def change_star_data(): |
|
|
|
import re |
|
|
|
count = frappe.db.sql(''' |
|
|
|
select count(*) from tabProcedure_Details where content like '%**%'; |
|
|
|
''', as_dict=1) |
|
|
|
print(count) |
|
|
|
|
|
|
|
data = frappe.db.sql(''' |
|
|
|
select content_type,content,name,parent,replace(content,'**','abcxyz ') as new_content from tabProcedure_Details where content like '%**%'; |
|
|
|
''', as_dict=1) |
|
|
|
for v in data: |
|
|
|
result = re.split(r"abcxyz ", v['new_content'], flags=0) |
|
|
|
FLAG = 0 |
|
|
|
sts = '' |
|
|
|
if len(result) > 1: |
|
|
|
sts += result[0] |
|
|
|
for r in range(1, len(result)): |
|
|
|
if FLAG == 0: |
|
|
|
sts += '<b>' + result[r] + '</b>' |
|
|
|
FLAG = 1 |
|
|
|
else: |
|
|
|
sts += result[r] |
|
|
|
FLAG = 0 |
|
|
|
frappe.db.sql( |
|
|
|
f'''update tabProcedure_Details set content = '{sts}' where name = '{v['name']}'; ''') |
|
|
|
return data |
|
|
|