Skip to content

Commit 172901d

Browse files
committed
Update flask_server.py
1 parent 10e5012 commit 172901d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

flask_server.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,20 @@ def get_data(data_type):
275275
return data_dictionary
276276

277277

278-
@app.route('/data/<data_type>')
278+
@app.route('/ui/')
279+
def output_ui_variables()
280+
data_dictionary = get_data("ui")
281+
282+
# calculate fuel percentage
283+
fuel_quantity = data_dictionary.get("FUEL_TOTAL_QUANTITY")
284+
fuel_capacity = data.dictionary.get("FUEL_TOTAL_CAPACITY")
285+
fuel_percantage = fuel quantity / fuel_capacity
286+
287+
data_dictionary["FUEL_PERCENTAGE"] = fuel_percantage
288+
return jsonify(data_dictionary)
289+
290+
291+
@app.route('/data/<data_type>/')
279292
def output_detailed_json_data(data_type):
280293

281294
data_dictionary = get_data(data_type)

0 commit comments

Comments
 (0)