Code clean up. Better debugging. Work on event session, presentation, and presenter.

This commit is contained in:
Scott Idem
2021-09-29 14:18:34 -04:00
parent b2c70c0c87
commit be788fc5e6
10 changed files with 253 additions and 159 deletions

View File

@@ -22,10 +22,6 @@ from app.models.event_session_models import Event_Session_Base
# ### BEGIN ### API Event Session Methods ### load_event_session_obj() ###
def load_event_session_obj(
event_session_id: int|str,
limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
model_as_dict: bool = False,
enabled: str = 'enabled', # enabled, disabled, all
hidden: str = 'not_hidden', # hidden, not_hidden, all
inc_file_count: bool = False, # NOTE: file counts are from separate views
@@ -52,6 +48,10 @@ def load_event_session_obj(
inc_poc_event_person: bool = False,
inc_person: bool = False,
inc_user: bool = False,
limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
model_as_dict: bool = False,
) -> Event_Session_Base|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
@@ -159,11 +159,11 @@ def load_event_session_obj(
if hidden in ['hidden', 'not_hidden', 'all']:
if hidden == 'hidden':
data['hidden'] = True
sql_hidden = f'AND `event_presentation`.hidden = :hidden'
data['hide'] = True
sql_hidden = f'AND `event_presentation`.hide = :hide'
elif hidden == 'not_hidden':
data['hidden'] = False
sql_hidden = f'AND `event_presentation`.hidden = :hidden'
data['hide'] = False
sql_hidden = f'AND `event_presentation`.hide = :hide'
elif hidden == 'all':
sql_hidden = ''
@@ -271,10 +271,10 @@ def load_event_session_obj(
# ### BEGIN ### API Event Session Methods ### get_event_session_rec_list() ###
def get_event_session_rec_list(
event_id: str,
review: str = 'ready', # ready, not_ready, all
approved: str = 'approved', # approved, not_approved, all
hidden: str = 'hidden', # hidden, not_hidden, all
enabled: str = 'enabled', # enabled, disabled, all
approved: str = 'all', # approved, not_approved, all
hidden: str = 'not_hidden', # hidden, not_hidden, all
review: str = 'all', # ready, not_ready, all
limit: int = 100,
) -> list|bool:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -310,11 +310,11 @@ def get_event_session_rec_list(
if hidden in ['hidden', 'not_hidden', 'all']:
if hidden == 'hidden':
data['hidden'] = True
sql_hidden = f'AND `event_session`.hidden = :hidden'
data['hide'] = True
sql_hidden = f'AND `event_session`.hide = :hide'
elif hidden == 'not_hidden':
data['hidden'] = False
sql_hidden = f'AND `event_session`.hidden = :hidden'
data['hide'] = False
sql_hidden = f'AND `event_session`.hide = :hide'
elif hidden == 'all':
sql_hidden = ''
@@ -347,6 +347,8 @@ def get_event_session_rec_list(
{sql_limit};
"""
log.debug(sql)
if event_session_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
event_session_rec_li = event_session_rec_li_result