awsss 3 years ago
parent
commit
ff5bd2ca6e
  1. 15
      smart_service/apis/publish_api.py

15
smart_service/apis/publish_api.py

@ -45,11 +45,11 @@ def api_procedure(args, vehicle, language, version):
list2 = frappe.db.sql(
'''SELECT procedure_link, system, sub_system FROM %s.`tabPublish_Docs` WHERE parent='%s'; ''' % (
current_db_name, args), as_dict=True)
for d in list2:
frappe.db.sql(
"""UPDATE %s.`tabSystem Mapping_Sub System` SET procedure_status = '%s', procedure_is_published='1' where procedure_status = '%s' and `tabSystem Mapping_Sub System`.procedure='%s' and systems='%s' and sub_systems='%s' """ % (
current_db_name, 'Published', 'Publish Ready', d['procedure_link'], d['system'], d['sub_system']))
frappe.db.commit()
# for d in list2:
# frappe.db.sql(
# """UPDATE %s.`tabSystem Mapping_Sub System` SET procedure_status = '%s', procedure_is_published='1' where procedure_status = '%s' and `tabSystem Mapping_Sub System`.procedure='%s' and systems='%s' and sub_systems='%s' """ % (
# current_db_name, 'Published', 'Publish Ready', d['procedure_link'], d['system'], d['sub_system']))
# frappe.db.commit()
file_name = '/files/json_files/' + file_name
return file_name
@ -61,6 +61,7 @@ def json_grouping(args, language):
docs_child = frappe.db.get_list('Publish_Docs', filters={'parent': args},
fields=['variant_mapping', 'system', 'sub_system', 'procedure_status',
'procedure_link'])
lang = {'language': language}
variant = set()
system = {}
@ -87,8 +88,7 @@ def json_grouping(args, language):
subsystem[i] = temp_set
final = []
count = 0
count = 0
active_status_case = "CASE WHEN active_status = 'Active' THEN 'True' ELSE 'False' END AS active_status"
for d in variant:
@ -117,7 +117,6 @@ def json_grouping(args, language):
{0}.`tabSystem Mapping_Sub System` as tmss inner join {0}.`tabSystems` as ts on tmss.systems = ts.system_name
where tmss.parent LIKE '{1}' and substring(tmss.parent,-5,2) = '{2}' and tmss.systems ='{3}';'''
.format(current_db_name, str(vari['name'] + "%"), language, i), as_dict=True)
sys = sys[0]
if sys['active_status'] == 'Active':
sys['active_status'] = True

Loading…
Cancel
Save