[FIX] Attendance API: return zone name or coordinates with fallback
This commit is contained in:
parent
348bee333d
commit
9d8dc0754b
|
|
@ -193,7 +193,8 @@ class AttendanceController(http.Controller):
|
||||||
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
|
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
|
||||||
'name': fields.datetime.now(),
|
'name': fields.datetime.now(),
|
||||||
# 'device_id':body.get('device_id'),
|
# 'device_id':body.get('device_id'),
|
||||||
'zone':zone.zone if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
'zone': (zone.zone or zone.name) if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
||||||
|
'zone_name': zone.id if zone else False,
|
||||||
'longitude': body.get('longitude'),
|
'longitude': body.get('longitude'),
|
||||||
'latitude':body.get('latitude'),
|
'latitude':body.get('latitude'),
|
||||||
})
|
})
|
||||||
|
|
@ -208,7 +209,7 @@ class AttendanceController(http.Controller):
|
||||||
"action": attendance.action,
|
"action": attendance.action,
|
||||||
"attendance_status": attendance.action,
|
"attendance_status": attendance.action,
|
||||||
"time": str(date),
|
"time": str(date),
|
||||||
"zone": attendance.zone,
|
"zone": (attendance.zone_name.zone or attendance.zone_name.name) if attendance.zone_name else attendance.zone,
|
||||||
"longitude": attendance.longitude,
|
"longitude": attendance.longitude,
|
||||||
"latitude": attendance.latitude,
|
"latitude": attendance.latitude,
|
||||||
"range": zone.allowed_range if zone else False,
|
"range": zone.allowed_range if zone else False,
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ class AttendanceController(http.Controller):
|
||||||
if attendance:
|
if attendance:
|
||||||
date = attendance.name.time()
|
date = attendance.name.time()
|
||||||
data.update({'id': attendance.id , 'action': attendance.action,
|
data.update({'id': attendance.id , 'action': attendance.action,
|
||||||
'attendance_status': attendance.action, 'time': str(date), 'zone': attendance.zone,
|
'attendance_status': attendance.action, 'time': str(date), 'zone': (attendance.zone_name.zone or attendance.zone_name.name) if attendance.zone_name else attendance.zone,
|
||||||
'longitude': attendance.longitude, 'latitude': attendance.latitude})
|
'longitude': attendance.longitude, 'latitude': attendance.latitude})
|
||||||
_logger.error(data)
|
_logger.error(data)
|
||||||
return http_helper.response(message="Refresh Successfully", data=data)
|
return http_helper.response(message="Refresh Successfully", data=data)
|
||||||
|
|
@ -229,7 +229,8 @@ class AttendanceController(http.Controller):
|
||||||
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
|
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
|
||||||
'name': fields.datetime.now(),
|
'name': fields.datetime.now(),
|
||||||
# 'device_id':body.get('device_id'),
|
# 'device_id':body.get('device_id'),
|
||||||
'zone':zone.zone if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
'zone': (zone.zone or zone.name) if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
||||||
|
'zone_name': zone.id if zone else False,
|
||||||
'longitude': body.get('longitude'),
|
'longitude': body.get('longitude'),
|
||||||
'latitude':body.get('latitude'),
|
'latitude':body.get('latitude'),
|
||||||
})
|
})
|
||||||
|
|
@ -245,7 +246,7 @@ class AttendanceController(http.Controller):
|
||||||
"action": attendance.action,
|
"action": attendance.action,
|
||||||
"attendance_status": attendance.action,
|
"attendance_status": attendance.action,
|
||||||
"time": str(date),
|
"time": str(date),
|
||||||
"zone": attendance.zone,
|
"zone": (attendance.zone_name.zone or attendance.zone_name.name) if attendance.zone_name else attendance.zone,
|
||||||
"longitude": attendance.longitude,
|
"longitude": attendance.longitude,
|
||||||
"latitude": attendance.latitude,
|
"latitude": attendance.latitude,
|
||||||
"range": zone.allowed_range if zone else False,
|
"range": zone.allowed_range if zone else False,
|
||||||
|
|
@ -466,7 +467,8 @@ class AttendanceController(http.Controller):
|
||||||
'action': 'sign_out',
|
'action': 'sign_out',
|
||||||
'action_type': 'auto',
|
'action_type': 'auto',
|
||||||
'name': last,
|
'name': last,
|
||||||
'zone': "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
'zone': (zone.zone or zone.name) if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
|
||||||
|
'zone_name': zone.id if zone else False,
|
||||||
'longitude': body.get('longitude'),
|
'longitude': body.get('longitude'),
|
||||||
'latitude': body.get('latitude'),
|
'latitude': body.get('latitude'),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue