def get(self, type: str):
     """Get the highest amount of snow or rain that is forecast today"""
     if type == 'snow':
         return db.execute_query(Query.select_max_overview_snow).fetchone()
     elif type == 'rain':
         return db.execute_query(Query.select_max_overview_rain).fetchone()
     else:
         api.abort(404)
    def get(self, resort_id: int):
        """Get the latest weather report for the given overview identifier"""
        result = db.execute_query(Query.select_weather_recent,
                                  resort_id=resort_id)

        if result.rowcount == 1:
            return result.fetchone()
        api.abort(404)
Beispiel #3
0
    def get(self, resort_id: int):
        """Get the past forecast reports of today for the given overview identifier"""
        result = db.execute_query(Query.select_forecast_past,
                                  resort_id=resort_id)

        if result.rowcount > 0:
            return result.fetchall()
        api.abort(404)
Beispiel #4
0
def get_high_score():
    highscore = db.execute_query(queries.get_highscore)

    if len(highscore) > 0:
        print(f'highscore: {highscore[0]["score"]}')

        # output_json = json.dumps({'highscore': highscore[0]["score"]})

        # response = make_response(output_json)
        # return response
        return jsonify({'highscore': highscore[0]["score"]})
 def get(self):
     """List all resorts with aggregate forecast data of today"""
     return db.execute_query(Query.select_overview).fetchall()
Beispiel #6
0
def set_score(highscore):
    if highscore > 0:
        db.execute_query(queries.save_score, {"score": highscore})

    response = get_high_score()
    return response