Beispiel #1
0
def chores():
    today = datetime.today()
    res = []
    weekday = C["daysPy"][today.weekday()]
    weekday_chores = CHORES.get(weekday)

    if weekday_chores != None:
        for chore in weekday_chores:
            time_range = chore.get("time_range")

            # add this chore to the list if it either has no time range, or it
            # has a time range and is in range
            if time_range == None:
                res.append(chore)
            else:
                if today.hour >= time_range[0] and today.hour < time_range[1]:
                    res.append(chore)

    return jsonify({"chores": res})
Beispiel #2
0
def chores():
    today = datetime.today()
    res = []
    weekday = C['daysPy'][today.weekday()]
    weekday_chores = CHORES.get(weekday)

    if weekday_chores != None:
        for chore in weekday_chores:
            time_range = chore.get('time_range')

            # add this chore to the list if it either has no time range, or it
            # has a time range and is in range
            if time_range == None:
                res.append(chore)
            else:
                if today.hour >= time_range[0] and today.hour < time_range[1]:
                    res.append(chore)

    return jsonify({'chores': res})
Beispiel #3
0
def chores():
    today = datetime.today()
    res = []
    weekday = C['daysPy'][today.weekday()]
    weekday_chores = CHORES.get(weekday)

    if weekday_chores != None:
        for chore in weekday_chores:
            time_range = chore.get('time_range')

            # add this chore to the list if it either has no time range, or it
            # has a time range and is in range
            if time_range == None:
                res.append(chore)
            else:
                if today.hour >= time_range[0] and today.hour < time_range[1]:
                    # scrub the time_range attr from the chore, since we are
                    # passing this to JS, which doesn't know about tuples.
                    chore.pop('time_range', None)
                    res.append(chore)

    return jsonify({
        'chores': res
    })