Work on event person tracking and related

This commit is contained in:
Scott Idem
2021-09-27 19:14:41 -04:00
parent 7ceb125026
commit 831ff8d4a0
7 changed files with 43 additions and 21 deletions

View File

@@ -82,6 +82,7 @@ def get_event_person_tracking_rec_list(
event_id: int|str = None,
event_person_id: int|str = None,
event_session_id: int|str = None,
in_out_type: str = None,
# for_obj_type: str, # NOTE: This is not for_type because the field name generated based
# for_obj_id: str, # NOTE: This is not for_id because the field name generated based
enabled: str = 'enabled', # enabled, disabled, all
@@ -127,6 +128,17 @@ def get_event_person_tracking_rec_list(
if event_id or event_person_id or event_session_id: pass
else: return False
if in_out_type:
if in_out_type == 'check':
sql_select_in_out_type = f'AND `event_person_tracking`.check_in_out = 1'
elif in_out_type == 'break':
sql_select_in_out_type = f'AND `event_person_tracking`.break_in_out = 1'
else:
data['other_type'] = in_out_type
sql_select_in_out_type = f'AND `event_person_tracking`.other_in_out = 1 AND `event_person_tracking`.other_type = :other_type'
else:
sql_select_in_out_type = f''
# if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name=for_obj_type): pass
# else: return False
@@ -159,6 +171,7 @@ def get_event_person_tracking_rec_list(
{sql_select_event_person_id}
{sql_select_event_session_id}
{sql_enabled}
{sql_select_in_out_type}
ORDER BY `event_person_tracking`.created_on DESC, `event_person_tracking`.updated_on DESC
{sql_limit};
"""