From 34af0ab280b99a681a793bf54830f92f680e52bf Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Mon, 29 May 2023 13:42:07 +0530 Subject: [PATCH] Link field issue fix query --- smart_service/apis/publish_api.py | 16 ++++++++++------ .../procedure_details/procedure_details.json | 3 +-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/smart_service/apis/publish_api.py b/smart_service/apis/publish_api.py index 2d70a8a..9c4871c 100644 --- a/smart_service/apis/publish_api.py +++ b/smart_service/apis/publish_api.py @@ -40,14 +40,14 @@ def custom_rate_limit(limit, seconds): def get_parent_map(input_list, parameter): - parentChildMap = {} + parent_child_map = {} for b in input_list: - parentChildMap.setdefault(b[parameter] or None, []).append(b) + parent_child_map.setdefault(b[parameter] or None, []).append(b) list1 = [] - for p in parentChildMap: - da = {"procedure_name": p, 'steps': parentChildMap[p]} + for p in parent_child_map: + da = {"procedure_name": p, 'steps': parent_child_map[p]} list1.append(da) - for i in parentChildMap[p]: + for i in parent_child_map[p]: del i['procedure_name'] del i['idx'] return list1 @@ -211,7 +211,8 @@ def json_grouping(args, language): # where parent ='{}' group by procedure_name,step_name,content_type,content order by idx asc; '''.format( # current_db_name, k['procedure_link']), as_dict=True) - proc_details = frappe.db.sql('''select procedure_name, step_name, content_type, content, + proc_details = frappe.db.sql('''select procedure_name, step_name, content_type, + case when content_type='Link' Then system_id else content end as content, file,idx as display_order,idx from {}.tabProcedure_Details where parent ='{}' order by idx asc; '''.format(current_db_name, k['procedure_link']), as_dict=True) @@ -863,7 +864,10 @@ def upv(): # frappe.db.commit() return 1 + """ Generate publish """ + + @frappe.whitelist() def run_publish(): new_publish('THAR-en -2023-05-21 16:57:54.119826', diff --git a/smart_service/transactions/doctype/procedure_details/procedure_details.json b/smart_service/transactions/doctype/procedure_details/procedure_details.json index 179927b..2181941 100644 --- a/smart_service/transactions/doctype/procedure_details/procedure_details.json +++ b/smart_service/transactions/doctype/procedure_details/procedure_details.json @@ -74,14 +74,13 @@ { "fieldname": "system_id", "fieldtype": "Data", - "hidden": 1, "label": "System ID" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-04-08 22:21:10.666175", + "modified": "2023-05-29 13:33:52.112577", "modified_by": "Administrator", "module": "Transactions", "name": "Procedure_Details",