1

qsort aangepast naar nest-qsort, bootstrap toegevoegd en html aangepast

This commit is contained in:
Ventilaar 2021-01-07 14:32:24 +01:00
parent e283e6f588
commit 4a09eec661
2 changed files with 35 additions and 22 deletions

6
run.py
View File

@ -35,11 +35,11 @@ def root():
entries = []
if request.args.get('sortby') == "name":
data_lst = sorting.qsort(data_tpl, 1)
data_lst = sorting.nest_qsort(data_tpl, 1)
elif request.args.get('sortby') == "release_date":
data_lst = sorting.qsort(data_tpl, 2)
data_lst = sorting.nest_qsort(data_tpl, 2)
elif request.args.get('sortby') == "price":
data_lst = sorting.qsort(data_tpl, 17)
data_lst = sorting.nest_qsort(data_tpl, 17)
else:
data_lst = data_tpl # hoezo memory efficient werken?

View File

@ -1,27 +1,40 @@
<html>
<head>
<title>Index</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body>
<h1>Hello!</h1>
<p>Eerste game in memory is <b>{{ first_entry[1] }}</b> met de game id <b>{{ first_entry[0] }}</b></p>
<p>Totaal aantal games in json array is <b>{{ sizedb }}</b></p>
<table style="width:50%">
<tr>
<th><a href="/">App ID</a></th>
<th><a href="?sortby=name">Name</a></th>
<th><a href="?sortby=release_date">Release date</a></th>
<th><a href="?sortby=price">Price</a></th>
</tr>
{% for row in entries %}
<tr style="text-align: center;">
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[17] }} ,-</td>
</tr>
{% endfor %}
</table>
<div class="container">
<div class="row">
<div class="col">
<h1>Welkom!</h1>
<p>Eerste game in memory is <b>{{ first_entry[1] }}</b> met de game id <b>{{ first_entry[0] }}</b></p>
<p>Totaal aantal games in memory is <b>{{ sizedb }}</b></p>
</div>
<div class="col">
<table class="table table-striped">
<thead>
<tr>
<th><a href="/">App ID</a></th>
<th><a href="?sortby=name">Name</a></th>
<th><a href="?sortby=release_date">Release date</a></th>
<th><a href="?sortby=price">Price</a></th>
</tr>
</thead>
<tbody>
{% for row in entries %}
<tr style="text-align: center;">
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[17] }} ,-</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>