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

@@ -38,7 +38,7 @@ logging.config.dictConfig({
} }
}, },
'root': { 'root': {
'handlers': ['console', 'log_file_all'], #, 'log_file_all', 'log_file_warning'], 'handlers': ['console'], #, 'log_file_all', 'log_file_warning'],
'level': 'WARNING', # WARNING 'level': 'WARNING', # WARNING
} }
}) })

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() ### # ### BEGIN ### API Event Location Methods ### load_event_location_obj() ###
# Updated 2022-09-23
@logger_reset @logger_reset
def load_event_location_obj( def load_event_location_obj(
event_location_id: int|str, event_location_id: int|str,
inc_event_device_list: bool = False, inc_event_device_list: bool = False,
inc_event_file_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_presentation_list: bool = False,
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
inc_file_count: bool = False, # NOTE: file counts are from separate views 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_id: int = None,
event_file_file_purpose: str = None, event_file_file_purpose: str = None,
event_file_priority: bool = None, event_file_priority: bool = None,
@@ -72,7 +75,6 @@ def load_event_location_obj(
# Updated 2021-10-21 # Updated 2021-10-21
if inc_event_file_list: if inc_event_file_list:
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('Need to include event file list...') log.info('Need to include event file list...')
from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj 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), event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled, enabled = enabled,
# inc_hosted_file = inc_hosted_file, # 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) event_file_result_list.append(load_event_file_result)
else: else:
@@ -106,6 +105,38 @@ def load_event_location_obj(
else: else:
event_location_obj.event_file_list = None 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: if inc_event_presentation_list:
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL # 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() ### # ### BEGIN ### API Event Session Methods ### load_event_session_obj() ###
# Updated 2022-09-23
@logger_reset @logger_reset
def load_event_session_obj( def load_event_session_obj(
event_session_id: int|str, event_session_id: int|str,
@@ -42,7 +43,7 @@ def load_event_session_obj(
inc_event_person_profile: bool = False, inc_event_person_profile: bool = False,
inc_event_person_list: bool = False, inc_event_person_list: bool = False,
inc_event_presentation_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_presenter_list: bool = False,
inc_event_registration_list: bool = False, inc_event_registration_list: bool = False,
inc_event_track: 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_badge_list: pass
if inc_event_device_list: pass if inc_event_device_list: pass
# Updated 2021-10-21
if inc_event_file_list: if inc_event_file_list:
log.info('Need to include 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), event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled, enabled = enabled,
inc_hosted_file = inc_hosted_file, 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) event_file_result_list.append(load_event_file_result)
else: else:
@@ -147,9 +146,6 @@ def load_event_session_obj(
event_file_id = event_file_rec.get('event_file_id', None), event_file_id = event_file_rec.get('event_file_id', None),
enabled = enabled, enabled = enabled,
inc_hosted_file = inc_hosted_file, 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) event_file_result_list.append(load_event_file_result)
else: else:

View File

@@ -50,6 +50,7 @@ class Event_Location_Base(BaseModel):
internal_notes_staff: Optional[str] # staffing and labor internal_notes_staff: Optional[str] # staffing and labor
file_count: Optional[int] file_count: Optional[int]
internal_use_count: Optional[int] # Should be renamed to "internal_use_file_count"???
alert: Optional[bool] alert: Optional[bool]
alert_msg: Optional[str] alert_msg: Optional[str]
@@ -82,6 +83,7 @@ class Event_Location_Base(BaseModel):
event_abstract_list: Optional[list] # Optional[Event_Abstract_Base] event_abstract_list: Optional[list] # Optional[Event_Abstract_Base]
event_device_list: Optional[list] # Optional[Event_Device_Base] event_device_list: Optional[list] # Optional[Event_Device_Base]
event_file_list: Optional[list] # Optional[Event_File_Base] event_file_list: Optional[list] # Optional[Event_File_Base]
event_file_internal_use_list: Optional[list] # Optional[Event_File_Base]
event_presentation_list: Optional[list] # Optional[Event_Presentation_Base] event_presentation_list: Optional[list] # Optional[Event_Presentation_Base]
event_presenter_list: Optional[list] # Optional[Event_Presenter_Base] event_presenter_list: Optional[list] # Optional[Event_Presenter_Base]
event_session_list: Optional[list] # Optional[Event_Session_Base] event_session_list: Optional[list] # Optional[Event_Session_Base]

View File

@@ -93,7 +93,7 @@ class Event_Session_Base(BaseModel):
internal_notes_staff: Optional[str] # staffing and labor internal_notes_staff: Optional[str] # staffing and labor
file_count: Optional[int] file_count: Optional[int]
internal_use_count: Optional[int] internal_use_count: Optional[int] # Should be renamed to "internal_use_file_count"???
status: Optional[int] status: Optional[int]
review: Optional[bool] review: Optional[bool]

View File

@@ -136,11 +136,12 @@ async def patch_event_location_obj_exist_v4(
# ### BEGIN ### API Event Location ### get_event_location_obj() ### # ### BEGIN ### API Event Location ### get_event_location_obj() ###
# Updated 2021-10-09 # Updated 2022-09-23
@router.get('/event/location/{event_location_id}', response_model=Resp_Body_Base) @router.get('/event/location/{event_location_id}', response_model=Resp_Body_Base)
async def get_event_location_obj( async def get_event_location_obj(
event_location_id: str = Query(..., min_length=11, max_length=22), event_location_id: str = Query(..., min_length=11, max_length=22),
inc_event_file_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_presentation_list: bool = False,
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
@@ -162,6 +163,7 @@ async def get_event_location_obj(
if event_location_obj := load_event_location_obj( if event_location_obj := load_event_location_obj(
event_location_id = event_location_id, event_location_id = event_location_id,
inc_event_file_list = inc_event_file_list, inc_event_file_list = inc_event_file_list,
inc_event_file_internal_use_list = inc_event_file_internal_use_list,
inc_event_presentation_list = inc_event_presentation_list, inc_event_presentation_list = inc_event_presentation_list,
inc_event_presenter_list = inc_event_presenter_list, inc_event_presenter_list = inc_event_presenter_list,
inc_event_session_list = inc_event_session_list, inc_event_session_list = inc_event_session_list,

View File

@@ -462,7 +462,7 @@ async def get_event_session_obj_li(
# ### BEGIN ### API Event Session ### get_event_session_obj() ### # ### BEGIN ### API Event Session ### get_event_session_obj() ###
# Updated 2021-09-28 # Updated 2022-09-23
@router.get('/event/session/{event_session_id}', response_model=Resp_Body_Base) @router.get('/event/session/{event_session_id}', response_model=Resp_Body_Base)
async def get_event_session_obj( async def get_event_session_obj(
event_session_id: str = Query(..., min_length=11, max_length=22), event_session_id: str = Query(..., min_length=11, max_length=22),
@@ -485,13 +485,13 @@ async def get_event_session_obj(
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_registration_list: bool = False, inc_event_registration_list: bool = False,
inc_event_track: bool = False, inc_event_track: bool = False,
inc_file_count: bool = False, # NOTE: file counts are from separate views
inc_poc_event_person: bool = False, inc_poc_event_person: bool = False,
inc_person: bool = False, # Under event_person inc_person: bool = False, # Under event_person
inc_user: bool = False, # Under event_person inc_user: bool = False, # Under event_person
review: str = 'ready', # ready, not_ready, all review: str = 'ready', # ready, not_ready, all
approved: str = 'approved', # approved, not_approved, all approved: str = 'approved', # approved, not_approved, all
hidden: str = 'not_hidden', # hidden, not_hidden, all hidden: str = 'not_hidden', # hidden, not_hidden, all
inc_file_count: bool = False, # NOTE: file counts are from separate views
x_account_id: str = Header(...), x_account_id: str = Header(...),
by_alias: Optional[bool] = True, by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True, exclude_unset: Optional[bool] = True,