"""get_date_range task.""" from garcon import task from activity_detector.flows.analytics_digest import config from activity_detector.utils import dates @task.decorate(timeout=300) def get_date_range(activity): """Get the date range for which to run the analytics digest. Args: activity (ActivityWorker): garcon activity worker Returns: dict: start_date (str): the start date end_date (str): the end date """ return { 'start_date': dates.get_friday_before_last().strftime( config.DATE_FORMAT), 'end_date': dates.get_last_thursday().strftime( config.DATE_FORMAT) }