def get_next_survey_bot()

in lambda/src/data_access/survey_completion.py [0:0]


def get_next_survey_bot(user_id, report_date):
    report_date_str = format_date_to_str(report_date)
    survey_entry = get_survey_completion_entry(user_id, report_date_str)
    if not survey_entry:
        return None
    if SURVEY_TBC_COL not in survey_entry or len(survey_entry[SURVEY_TBC_COL]) == 0:
        logger.info(f'No more surveys for {user_id} and {report_date_str}')
        return None
    surveys_to_complete = survey_entry[SURVEY_TBC_COL]
    top_survey = surveys_to_complete[0]
    next_bot = top_survey['BotName']
    logger.info(f'Next bot for {user_id} and {report_date_str} is {next_bot}.')
    return next_bot