I am trying to run this code with the help of https://{server}/api/method/path.to.function
but its giving me brokenpipe error no.32 please help
import frappe
@frappe.whitelist()
def emploc(employee=None):
loc = frappe.db.sql(
"""SELECT ec.employee, ec.employee_name, ec.device_id, ec.time, e.department, e.payroll_cost_center, f.file_url
FROM `tabEmployee Checkin` ec
INNER JOIN `tabEmployee` e ON ec.employee = e.name
LEFT JOIN `tabFile` f ON f.attached_to_name = e.user_id AND (f.file_url LIKE '%.png' OR f.file_url LIKE '%.jpg') AND f.attached_to_field = 'user_image'
WHERE ec.log_type = 'IN' AND ec.employee = %s""",
(employee),
as_dict=True
)
for entry in loc:
device_id = entry.get('device_id', '')
if device_id:
if ',' in device_id:
if ', ' in device_id:
latitude, longitude = device_id.split(', ')
else:
latitude, longitude = device_id.split(',')
entry['latitude'] = latitude
entry['longitude'] = longitude
del entry['device_id']
else:
continue
bl = frappe.db.sql("""SELECT name, from_lat, to_lat, from_long, to_long
FROM `tabBranch Location`""", as_dict=True)
return loc, bl