Minor changes. Added even_location_list to event_session.

This commit is contained in:
Scott Idem
2022-09-20 18:32:42 -04:00
parent b85397a9b5
commit 7fe007a098
3 changed files with 36 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ from app.lib_general import log, logging, logger_reset
# from app.methods.event_methods import load_event_obj
from app.methods.event_file_methods import load_event_file_obj_list
from app.methods.event_location_methods import load_event_location_obj
from app.methods.event_location_methods import load_event_location_obj, get_event_location_rec_list
from app.methods.event_person_methods import load_event_person_obj, update_event_person_obj
from app.methods.event_presentation_methods import create_event_presentation_obj, create_update_event_presentation_obj_v4, load_event_presentation_obj, update_event_presentation_obj_v3
# from app.methods.event_presenter_methods import load_event_presenter_obj
@@ -37,6 +37,7 @@ def load_event_session_obj(
inc_event_file_list: bool = False,
inc_event_file_internal_use_list: bool = False,
inc_event_location: bool = False,
inc_event_location_list: bool = False,
inc_event_person: bool = False,
inc_event_person_profile: bool = False,
inc_event_person_list: bool = False,
@@ -174,6 +175,34 @@ def load_event_session_obj(
else:
event_session_obj.event_location = None
# Updated 2022-09-20
if inc_event_location_list:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event location list...')
if event_location_rec_list_result := get_event_location_rec_list(
event_id = event_id,
enabled = enabled, # enabled, disabled, all
hidden = 'all', # hidden, not_hidden, all
limit = limit,
):
event_location_result_list = []
for event_location_rec in event_location_rec_list_result:
if load_event_location_result := load_event_location_obj(
event_location_id = event_location_rec.get('event_location_id', None),
enabled = enabled,
limit = limit,
):
event_location_result_list.append(load_event_location_result)
else:
event_location_result_list.append(None)
log.debug(event_location_result_list)
event_session_obj.event_location_list = event_location_result_list
elif isinstance(event_location_rec_list_result, list):
event_session_obj.event_location_list = []
else:
event_session_obj.event_location_list = None
if inc_event_person_list: pass
if inc_event_presentation_list:

View File

@@ -122,10 +122,13 @@ class Event_Session_Base(BaseModel):
# Including convenience data
# This is only for convenience. Probably going to keep unless it causes a problem.
# event_code: Optional[str]
event_name: Optional[str]
event_start_datetime: Optional[datetime.datetime]
event_end_datetime: Optional[datetime.datetime]
# event_location_code: Optional[str]
event_location_name: Optional[str]
# event_track_code: Optional[str]
event_track_name: Optional[str]
# location_name: Optional[str] = Field(
# alias = 'event_location_name'
@@ -142,6 +145,7 @@ class Event_Session_Base(BaseModel):
event_file_list: Optional[list] # Optional[Event_File_Base]
event_file_internal_use_list: Optional[list] # Optional[Event_File_Base]
event_location: Optional[Union[Event_Location_Base, None]]
event_location_list: Optional[list[Event_Location_Base]] # Optional[Event_Location_Base]
event_person_list: Optional[list]
event_presenter_cat: Optional[Union[str, None]]
event_presentation_list: Optional[list[Event_Presentation_Base]] # Optional[Event_Presentation_Base]

View File

@@ -476,6 +476,7 @@ async def get_event_session_obj(
inc_event_file_list: bool = False,
inc_event_file_internal_use_list: bool = False,
inc_event_location: bool = False,
inc_event_location_list: bool = False,
inc_event_person: bool = False, # Under event_presenter
inc_event_person_profile: bool = False, # Under event_person
inc_event_person_list: bool = False,
@@ -518,6 +519,7 @@ async def get_event_session_obj(
inc_event_file_list = inc_event_file_list,
inc_event_file_internal_use_list = inc_event_file_internal_use_list,
inc_event_location = inc_event_location,
inc_event_location_list = inc_event_location_list,
inc_event_person = inc_event_person,
inc_event_person_profile = inc_event_person_profile,
inc_event_person_list = inc_event_person_list,