예제 #1
0
def auto_dates(sport):
    """
    Will get the dates from the current date to the last entry.
    :return:
    """
    # Get latest entry in the db
    start_date = query_db.get_last_entry(sport)

    # Get int weeks for football
    if sport == 'football':
        end_date = 17
        return range(start_date + 1, end_date + 1)
    else:
        last_date_of_season = {
            'basketball': datetime.date(2015, 4, 15),
            'baseball': datetime.date(2015, 10, 4)
        }
        # Get yesterday to skip games in progress.
        yesterday = datetime.date.today() - datetime.timedelta(days=1)
        # Get the earlier date between current date and last day of season.
        end_date = min(last_date_of_season[sport], yesterday)

    if start_date >= end_date:
        return []

    return date_range([start_date, end_date])
예제 #2
0
def auto_dates(sport):
    """
    Will get the dates from the current date to the last entry.
    :return:
    """
    # Get latest entry in the db
    start_date = query_db.get_last_entry(sport)

    # Get int weeks for football
    if sport == 'football':
        end_date = 17
        return range(start_date + 1, end_date + 1)
    else:
        # Get yesterdays date (dont want games in progress)
        end_date = datetime.date.today() - datetime.timedelta(days=1)

    if start_date >= end_date:
        return []

    return date_range([start_date, end_date])
예제 #3
0
def auto_dates(sport):
    """
    Will get the dates from the current date to the last entry.
    :return:
    """
    # Get latest entry in the db
    start_date = query_db.get_last_entry(sport)

    # Get int weeks for football
    if sport == 'football':
        end_date = 17
        return range(start_date + 1, end_date + 1)
    else:
        last_date_of_season = {'basketball': datetime.date(2015, 4, 15),
                               'baseball': datetime.date(2015, 10, 4)}
        # Get yesterday to skip games in progress.
        yesterday = datetime.date.today() - datetime.timedelta(days=1)
        # Get the earlier date between current date and last day of season.
        end_date = min(last_date_of_season[sport], yesterday)

    if start_date >= end_date:
        return []

    return date_range([start_date, end_date])