Updated event location related. General code clean up and updates.

This commit is contained in:
Scott Idem
2022-09-23 18:31:17 -04:00
parent d2d6136bc4
commit a56a4b9647
7 changed files with 47 additions and 16 deletions

View File

@@ -17,15 +17,18 @@ from app.models.event_location_models import Event_Location_Base
# ### BEGIN ### API Event Location Methods ### load_event_location_obj() ###
# Updated 2022-09-23
@logger_reset
def load_event_location_obj(
event_location_id: int|str,
inc_event_device_list: bool = False,
inc_event_file_list: bool = False,
inc_event_file_internal_use_list: bool = False,
inc_event_presentation_list: bool = False,
inc_event_presenter_list: bool = False,
inc_event_session_list: bool = False,
inc_file_count: bool = False, # NOTE: file counts are from separate views
inc_hosted_file: bool = False,
event_file_file_purpose_id: int = None,
event_file_file_purpose: str = None,
event_file_priority: bool = None,
@@ -72,7 +75,6 @@ def load_event_location_obj(
# Updated 2021-10-21
if inc_event_file_list:
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event file list...')
from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj
@@ -92,9 +94,6 @@ def load_event_location_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
# inc_hosted_file = inc_hosted_file,
# model_as_dict = True,
# by_alias = by_alias,
# exclude_unset = False,
):
event_file_result_list.append(load_event_file_result)
else:
@@ -106,6 +105,38 @@ def load_event_location_obj(
else:
event_location_obj.event_file_list = None
if inc_event_file_internal_use_list:
log.info('Need to include event file internal use list...')
from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj
if event_file_rec_list_result := get_event_file_rec_list(
for_type = 'event_location',
for_id = event_location_id,
file_purpose_id = event_file_file_purpose_id,
file_purpose = event_file_file_purpose,
internal_use = True,
priority = event_file_priority,
group = event_file_group,
enabled = enabled,
limit = limit,
):
event_file_result_list = []
for event_file_rec in event_file_rec_list_result:
if load_event_file_result := load_event_file_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
inc_hosted_file = inc_hosted_file,
):
event_file_result_list.append(load_event_file_result)
else:
event_file_result_list.append(None)
log.debug(event_file_result_list)
event_location_obj.event_file_internal_use_list = event_file_result_list
elif isinstance(event_file_rec_list_result, list):
event_location_obj.event_file_internal_use_list = []
else:
event_location_obj.event_file_internal_use_list = None
if inc_event_presentation_list:
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL

View File

@@ -19,6 +19,7 @@ from app.models.event_session_models import Event_Session_Base
# ### BEGIN ### API Event Session Methods ### load_event_session_obj() ###
# Updated 2022-09-23
@logger_reset
def load_event_session_obj(
event_session_id: int|str,
@@ -42,7 +43,7 @@ def load_event_session_obj(
inc_event_person_profile: bool = False,
inc_event_person_list: bool = False,
inc_event_presentation_list: bool = False,
inc_event_presenter_cat: bool = False, # Concantinate presenter names
inc_event_presenter_cat: bool = False, # Concatenate presenter names
inc_event_presenter_list: bool = False,
inc_event_registration_list: bool = False,
inc_event_track: bool = False,
@@ -91,6 +92,7 @@ def load_event_session_obj(
if inc_event_badge_list: pass
if inc_event_device_list: pass
# Updated 2021-10-21
if inc_event_file_list:
log.info('Need to include event file list...')
@@ -112,9 +114,6 @@ def load_event_session_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
inc_hosted_file = inc_hosted_file,
# model_as_dict = True,
# by_alias = by_alias,
# exclude_unset = False,
):
event_file_result_list.append(load_event_file_result)
else:
@@ -147,9 +146,6 @@ def load_event_session_obj(
event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled,
inc_hosted_file = inc_hosted_file,
# model_as_dict = True,
# by_alias = by_alias,
# exclude_unset = False,
):
event_file_result_list.append(load_event_file_result)
else: