Ejemplo n.º 1
0
def get_sleep(username):
    timestamps = Timestamps.get_timestamps(username)
    http_status = 200 if timestamps else 404
    if timestamps is None:
        return jsonify({'timestamps': []}), http_status

    timestamps_list = [ts['timestamp'] for ts in timestamps]
    sleep = compute_sleep_time(timestamps_list)

    return jsonify({'sleep': sleep}), http_status
Ejemplo n.º 2
0
def get_sleep(username):
    timestamps = Timestamps.get_timestamps(username)
    http_status = 200 if timestamps else 404
    if timestamps is None:
        return jsonify({'timestamps': []}), http_status

    timestamps_list = [ts['timestamp'] for ts in timestamps]
    sleep = compute_sleep_time(timestamps_list)

    return jsonify({'sleep': sleep}), http_status
Ejemplo n.º 3
0
def get_timestamps(username):
    timestamps = Timestamps.get_timestamps(username)
    http_status = 200 if timestamps else 404
    if timestamps is None:
        timestamps = []
    return jsonify({'timestamps': timestamps}), http_status
Ejemplo n.º 4
0
def get_timestamps(username):
    timestamps = Timestamps.get_timestamps(username)
    http_status = 200 if timestamps else 404
    if timestamps is None:
        timestamps = []
    return jsonify({'timestamps': timestamps}), http_status