preparation commit for henni

This commit includes:
* sql conversion script
* fixes for the column type for lat and lng fields
* removes prints / console logs
* unneccessary comments
* if no home data is available, we center to germany
* hide non working brand logos
* on closed stations the word "closed" is printed instead of outdated
price
* updates on filling stations is done in chunks of max 10
* configuration separates between development and testing
This commit is contained in:
2017-11-24 09:08:04 +01:00
parent 543d3e1658
commit f7cb273254
9 changed files with 98 additions and 76 deletions

View File

@@ -93,9 +93,7 @@ def edit_consumable(cid):
if form.validate_on_submit():
consumable.name = form.name.data
consumable.unit = form.unit.data
print(form.ext_id.data)
consumable.ext_id = choices[form.ext_id.data][1]
print(consumable.ext_id)
try:
db.session.commit()
db_log_update(consumable)

View File

@@ -7,16 +7,9 @@ from ..entities import FillingStation
from .. import app, db, limiter
@app.route('/filling_stations/update')
def update_filling_stations():
print(FillingStation.query.all())
return jsonify({})
@app.route('/filling_stations/favourites/toggle/<fsid>')
def add_favourite_filling_stations(fsid):
favourite_ids = {x.id: x for x in current_user.favourite_filling_stations}
print(favourite_ids)
if fsid in favourite_ids:
current_user.favourite_filling_stations.remove(favourite_ids[fsid])
@@ -38,12 +31,12 @@ def query_filling_stations():
latitude = request.args.get('latitude')
longitude = request.args.get('longitude')
radius = request.args.get('radius', default=1.5)
type = request.args.get('type', default='all')
gas_type = request.args.get('type', default='all')
sort = request.args.get('sort', default='dist')
url = 'https://creativecommons.tankerkoenig.de/json/list.php'
params = {
'lat': latitude, 'lng': longitude, 'rad': radius, 'apikey': api_key, 'type': type, 'sort': sort
'lat': latitude, 'lng': longitude, 'rad': radius, 'apikey': api_key, 'type': gas_type, 'sort': sort
}
response = requests.get(url, params=params)
data = response.json()
@@ -67,24 +60,3 @@ def query_filling_stations():
station['state'] = 'normal'
db.session.commit()
return jsonify(data)
@app.route('/filling_stations/<fsid>', methods=['GET'])
@login_required
@limiter.limit('1 per second')
def query_filling_station_details(fsid):
api_key = app.config['TANKERKOENIG_API_KEY']
if ',' in fsid:
# more than one id, redirect to method 2 (preisabfrage)
url = 'https://creativecommons.tankerkoenig.de/json/prices.php'
params = {
'apikey': api_key, 'ids': fsid
}
else:
url = 'https://creativecommons.tankerkoenig.de/json/detail.php'
params = {
'apikey': api_key, 'id': fsid
}
response = requests.get(url, params=params)
return jsonify(response.json())

View File

@@ -236,7 +236,6 @@ def plan_pit_stop_form(vid, cid):
offers = []
for fs in current_user.favourite_filling_stations:
# if fs.open:
offers.append((fs, getattr(fs, consumable.ext_id),))
return render_template('planPitStopForm.html', vehicle=vehicle, consumable=consumable, offers=offers)