config.read(os.environ['SEEPARKINI'])
apikey = config.get('openweathermap', 'apikey')
cityid = config.get('openweathermap', 'cityid')
-mainsensor = config.get('temperature', 'mainsensor')
+mainsensor = config.get('webapp', 'mainsensor')
app = Flask(__name__)
app.json_encoder = JSONEncoder
)
duration = (end - begin).total_seconds()
day = 60 * 60 * 24
- if duration < day:
+ if duration <= day:
resolution = resolutions['day']
- elif duration < 7 * day:
+ elif duration <= 7 * day:
resolution = resolutions['week']
- elif duration < 31 * day:
+ elif duration <= 31 * day:
resolution = resolutions['month']
else:
resolution = resolutions['year']
# TODO: filter out samples from 'result'
- # something like
+ # something like
# select to_seconds(datetime) DIV (60*60*24) as interval_id, min(datetime), max(datetime), min(temp), avg(temp), max(temp), count(temp) from openweathermap group by interval_id order by interval_id;
return query.all()