mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-23 12:28:26 +00:00
Added Search Downloading again
This commit is contained in:
parent
db6cbb2615
commit
46130dc993
@ -151,8 +151,7 @@ def index():
|
||||
session["index_filter"]["location"] = form.location.data
|
||||
if form.email.data:
|
||||
session["index_filter"]["email"] = form.email.data
|
||||
# if form.download.data:
|
||||
# download = True
|
||||
|
||||
|
||||
# # Store previous form submission settings in the session, so they are preseved through pagination.
|
||||
filtered_samples = samples
|
||||
@ -181,9 +180,10 @@ def index():
|
||||
else:
|
||||
# Default to Todays Results
|
||||
filtered_samples = filtered_samples.filter(Sample.date >= date.today())
|
||||
if download:
|
||||
if request.args.get('download') == 'true':
|
||||
csv = __make_csv(filtered_samples)
|
||||
return send_file(csv, attachment_filename='data_export.csv', as_attachment=True)
|
||||
|
||||
############# Build Graphs ######################
|
||||
# Analysis
|
||||
station_charts = []
|
||||
@ -305,6 +305,13 @@ def index():
|
||||
stats = stats
|
||||
))
|
||||
|
||||
@app.route('/activate', methods=['GET', 'POST'])
|
||||
@superuser
|
||||
def activate_station():
|
||||
return render_template('layouts/default.html',
|
||||
base_href=BASE_HREF,
|
||||
content=render_template(
|
||||
'pages/stations.html'))
|
||||
|
||||
def __make_csv(sample_query):
|
||||
csvfile = io.StringIO()
|
||||
|
@ -78,7 +78,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/profile.html">
|
||||
<a class="nav-link" href="/activate">
|
||||
<em class="ni ni-single-02 text-yellow"></em> Active Locations
|
||||
</a>
|
||||
</li>
|
||||
@ -97,7 +97,7 @@
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://appseed.us/admin-dashboards/flask-dashboard-argon">
|
||||
<a class="nav-link" href="/">
|
||||
<em class="ni ni-book-bookmark"></em> App Information
|
||||
</a>
|
||||
</li>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col">
|
||||
<h5 class="card-title text-uppercase text-muted mb-0">Samples Today</h5>
|
||||
|
||||
<span id="stats_traffic" class="h2 font-weight-bold mb-0">{{stats.today}}</span>
|
||||
<span id="stats_traffic" class="h2 font-weight-bold mb-0">{{stats.today|safe}}</span>
|
||||
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@ -34,7 +34,7 @@
|
||||
<div class="col">
|
||||
<h5 class="card-title text-uppercase text-muted mb-0">2 Week Average</h5>
|
||||
|
||||
<span id="stats_users" class="h2 font-weight-bold mb-0">{{stats.weeks}}</span>
|
||||
<span id="stats_users" class="h2 font-weight-bold mb-0">{{stats.weeks|safe}}</span>
|
||||
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@ -58,7 +58,7 @@
|
||||
<h5 class="card-title text-uppercase text-muted mb-0">Samples in Search
|
||||
</h5>
|
||||
|
||||
<span id="stats_sales" class="h2 font-weight-bold mb-0">{{stats.all}}</span>
|
||||
<span id="stats_sales" class="h2 font-weight-bold mb-0">{{stats.all|safe}}</span>
|
||||
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
@ -121,7 +121,7 @@
|
||||
<h3 class="mb-0">Records to be processed</h3>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button type="submit" href="#!" class="btn btn-sm btn-primary">Download all</a>
|
||||
<a href="{{ url_for('index') }}?download=true" class="btn btn-sm btn-primary">Download all</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user