|
|
@ -224,22 +224,22 @@ def new_publish1(): |
|
|
|
with open(BASE_PATH + str(vehicle) + '-feature_finder.json') as outfile: |
|
|
|
data = json.load(outfile) |
|
|
|
data = data['data'] |
|
|
|
filter_json = filter_publish_json(data,variant) |
|
|
|
data = filter_json |
|
|
|
|
|
|
|
filter_json = filter_publish_json(data, variant) |
|
|
|
data = filter_json |
|
|
|
|
|
|
|
elif module == 'Repair/Service Check Sheet': |
|
|
|
with open(BASE_PATH + str(vehicle) + '-repair_check_sheet.json') as outfile: |
|
|
|
data = json.load(outfile) |
|
|
|
data = data['data'] |
|
|
|
filter_json = filter_publish_json(data,variant) |
|
|
|
data = filter_json |
|
|
|
filter_json = filter_publish_json(data, variant) |
|
|
|
data = filter_json |
|
|
|
|
|
|
|
elif module == 'QWIK Service': |
|
|
|
with open(BASE_PATH + str(vehicle) + '-qwik_service.json') as outfile: |
|
|
|
data = json.load(outfile) |
|
|
|
data = data['data'] |
|
|
|
filter_json = filter_publish_json(data,variant) |
|
|
|
data = filter_json |
|
|
|
filter_json = filter_publish_json(data, variant) |
|
|
|
data = filter_json |
|
|
|
|
|
|
|
elif module == 'Training Information': |
|
|
|
pass |
|
|
@ -266,17 +266,10 @@ def new_publish1(): |
|
|
|
@frappe.whitelist(methods=['POST'], allow_guest=1) |
|
|
|
def get_special_tool_information(vehicle): |
|
|
|
try: |
|
|
|
# special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, |
|
|
|
# my_id,keywords from `tabSpecial Tool Information` |
|
|
|
# where vehicle="{vehicle}";''', as_dict=1) |
|
|
|
|
|
|
|
special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,tool_name,aggregate_name, aggregate_image as 'tool_image', |
|
|
|
special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,aggregate_name, aggregate_image as 'tool_image', |
|
|
|
pdf,image,video,keywords,display_order,my_id,active_status from `tabSpecial Tool Information` |
|
|
|
where vehicle= '%s' ;''' % (vehicle), as_dict=1) |
|
|
|
for s in special_tool_information: |
|
|
|
# s['tool_usage_content'] = frappe.db.sql(f'''select idx as 'display_order',image,content,video,asset_type,active_status |
|
|
|
# from `tabMST Information Assets` where parent = '{s['name']}' order by display_order;''', as_dict=1) |
|
|
|
|
|
|
|
s['instructions'] = frappe.db.sql('''select idx as 'display_order',step_name,content_type,content,attach_file,title |
|
|
|
from `tabInstructions` where parent = '%s' order by display_order;''' % (s['name']), as_dict=1) |
|
|
|
return True, special_tool_information |
|
|
@ -344,10 +337,11 @@ def update_publish_mapping(vehicle, variant, language, module): |
|
|
|
doc.save() |
|
|
|
return 1 |
|
|
|
|
|
|
|
def filter_publish_json(src_json,filter_cond): |
|
|
|
|
|
|
|
def filter_publish_json(src_json, filter_cond): |
|
|
|
try: |
|
|
|
filtered_json = [src_json.get(filter_cond, None) for d in src_json] |
|
|
|
|
|
|
|
|
|
|
|
return filtered_json[0] |
|
|
|
except Exception as e: |
|
|
|
frappe.throw(str(e)) |
|
|
|
frappe.throw(str(e)) |
|
|
|