Skip to content

Commit

Permalink
Big helpful last waiting time for mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed Nov 25, 2018
1 parent 58f09e1 commit 97cbf7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/c3queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ def structure_data(data):
result[ping.day][key][-1] = merge_pings(result[ping.day][key][-1], entry)
else:
result[ping.day][key].append(entry)
return result
entry['year'] = ping.year
entry['day'] = ping.day
return result, entry


@aiohttp_jinja2.template('stats.html')
async def stats(request):
data = await parse_data()
data = structure_data(data)
data, last_ping = structure_data(data)
charts = []
for day_number, values in data.items():
line_chart = pygal.TimeLine(
Expand All @@ -74,7 +76,7 @@ async def stats(request):
for year, year_data in values.items():
line_chart.add(year, [(d['ping'], d['duration']) for d in year_data])
charts.append(line_chart.render(is_unicode=True))
return {'charts': charts}
return {'charts': charts, 'last_ping': last_ping}


async def pong(request):
Expand Down
1 change: 1 addition & 0 deletions src/static/c3queue.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ main #explanation {
font-weight: bold;
font-size: 20px;
text-transform: uppercase;
text-align: center;
display: block;
margin-left: auto;
margin-right: auto;
Expand Down
9 changes: 6 additions & 3 deletions src/templates/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@
<main>
<div id="explanation">
<div class="inner">
This is how long the queue at the entrance of 34C3 took on Day 0 and Day 1.<br>
This graph will be updated live during Day 0 and Day 1.<br>
You can download the <a href="/data">raw data</a> here.
Last known waiting time: {{ last_ping.duration }} minutes on Day {{ last_ping.day - 26 }}, {{ last_ping.pong.hour }}:{{ last_ping.pong.minute }} ({{ last_ping.year - 1983 }}C3).
</div>
</div>
<div id="c3q">
{% for chart in charts %}
{{ chart|safe }}
{% endfor %}
</div>
<div id="explanation">
<div class="inner">
You can download the <a href="/data">raw data</a> here.
</div>
</div>
</main>
</body>
</html>

0 comments on commit 97cbf7c

Please sign in to comment.