Compare commits

..

5 Commits

Author SHA1 Message Date
18ce2b5399 Update static 2022-06-20 20:16:24 -04:00
Gogs
63b6d6944d Change python to actual booleans. 2017-04-09 18:36:01 -04:00
Gogs
bc284e2514 Updating html field types 2017-04-04 02:01:06 -04:00
Gogs
e3cebcb73b Changing number fields to allow decimals 2017-02-12 01:55:22 -05:00
Gogs
7d760985b8 Add 5 latest readings to the bottom of the page 2017-02-03 00:32:23 -05:00
11 changed files with 32 additions and 14 deletions

View File

@ -16,7 +16,10 @@ def success():
@app.route('/', methods=['GET', 'POST'])
def main_page():
return render_template('index.html')
client = InfluxDBClient('localhost', 8086, 'root', 'root', 'gas')
query = 'select TOP(odometer, 5) from odyssey'
data = client.query(query)
return render_template('index.html', data=data)
@app.route('/add_time', methods=['POST', 'GET'])
def add_time():
@ -32,6 +35,8 @@ def add_time():
time = now
odometer = request.form['odometer']
oilhealth= request.form['oilhealth']
if oilhealth != '':
oilhealth = float(oilhealth)
fuel = request.form['fuel']
if fuel != '':
fuel = float(fuel)
@ -39,6 +44,10 @@ def add_time():
if fuelcost != '':
fuelcost = float(fuelcost)
winter = request.form['winter']
if winter == 'TRUE':
winter = True
else:
winter = False
json_body = [
{
@ -49,7 +58,7 @@ def add_time():
"oilhealth": oilhealth,
"fuel": fuel,
"fuelcost": fuelcost,
"winter": bool(winter)
"winter": winter
}
}
]

View File

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

View File

View File

View File

View File

View File

View File

View File

@ -17,45 +17,54 @@
<div class="row">
<div class="col-xs-4">
<label for="date">Date:</label>
<input type=text name="date" class="form-control" placeholder="Ex: 2009-11-10">
<input type=date name="date" class="form-control" placeholder="Ex: 2009-11-10">
</div>
<div class="col-xs-4">
<label for="time">Time:</label>
<input type=text name="time" class="form-control" placeholder="Ex: 17:59:03">
<input type=time name="time" class="form-control" placeholder="Ex: 17:59:03">
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label for="odometer">Odometer:</label>
<input type=text name="odometer" class="form-control" placeholder="Ex: 3008">
<input type=number name="odometer" class="form-control" placeholder="Ex: 3008">
</div>
<div class="col-xs-4">
<label for="oilhealth">Oil Health:</label>
<input type=text name="oilhealth" class="form-control" placeholder="Ex: 80">
<input type=number name="oilhealth" class="form-control" placeholder="Ex: 80">
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label for="fuel">Fuel (L):</label>
<input type=text name="fuel" class="form-control" placeholder="Ex: 70.175">
<input type=number step="0.001" name="fuel" class="form-control" placeholder="Ex: 70.175">
</div>
<div class="col-xs-4">
<label for="fuelcost">Fuel Cost ($/L):</label>
<input type=text name="fuelcost" class="form-control" placeholder="Ex: 1.059">
<input type=number step="0.001" name="fuelcost" class="form-control" placeholder="Ex: 1.059">
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label for="winter">Winter Tires:</label>
<select name="winter" class="form-control">
<option value="true">True</option>
<option value="false">False</option>
<select name="winter" class="form-control" default="false">
<option value="TRUE">True</option>
<option value="FALSE" selected>False</option>
</select>
</div>
</div>
</div><br>
<input type="submit" value="Go">
</div>
</form>
<br>
Last Mileage
<ul>
{% for point in data %}
{% for item in point %}
<li>
{{ item['top'] }}
</li>
{% endfor %}
{% endfor %}
{% endblock %}
</ul>