Example #1
0
def day_data(y, m, d):
    if date(y, m, d) < app.config["DAY0"]:
        abort(404)
    if date(y, m, d) > date.today():
        abort(404)

    day = Day.get_day(y, m, d)
    if not day.actual_value or date(y, m, d) == date.today():
        day.do_sync(send_mail=False, mark_synced=False)
    
    if not day.actual_value:
        abort(500, "Data currently not available")

    return jsonify(to_dict(day))
Example #2
0
 def as_dict(self):
     return {
         'day': to_dict(self),
         'bets': [to_dict(bet, recursive=False) for bet in self.bet_set.order('-ctime')],
     }