Code clean up. Work on event session and file counts for event models

This commit is contained in:
Scott Idem
2021-09-28 18:06:35 -04:00
parent fb7efa9930
commit e231090168
10 changed files with 79 additions and 11 deletions

View File

@@ -23,6 +23,8 @@ from app.models.event_presentation_models import Event_Presentation_Base
def load_event_presentation_obj(
event_presentation_id: int|str,
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
limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
@@ -54,8 +56,13 @@ def load_event_presentation_obj(
if event_presentation_id := redis_lookup_id_random(record_id_random=event_presentation_id, table_name='event_presentation'): pass
else: return False
if event_presentation_rec := sql_select(table_name='v_event_presentation', record_id=event_presentation_id): pass
else: return False
if inc_file_count:
log.info('Using view with file count')
if event_presentation_rec := sql_select(table_name='v_event_presentation_w_file_count', record_id=event_presentation_id): pass
else: return False
else:
if event_presentation_rec := sql_select(table_name='v_event_presentation', record_id=event_presentation_id): pass
else: return False
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_presentation_rec)
@@ -125,6 +132,10 @@ def load_event_presentation_obj(
if event_presenter_obj := load_event_presenter_obj(
event_presenter_id = event_presenter_id,
enabled = enabled,
# review = review,
# approved = approved,
hidden = hidden,
inc_file_count = inc_file_count,
inc_address = inc_address,
inc_contact = inc_contact,
inc_event_abstract_list = inc_event_abstract_list,