Browse Source

Refresh at startup and add refresh timestamp

Add a refresh timestamp, and generate the page at startup
(to pick up recent ethercalc changes).

Change-Id: I1fec2e29cabf434e0aa4466d426ce7f1777198b4
changes/57/478957/1
Thierry Carrez 4 years ago
parent
commit
d9d7753ee1
2 changed files with 5 additions and 1 deletions
  1. +1
    -1
      html/ptg.html
  2. +4
    -0
      ptgbot/db.py

+ 1
- 1
html/ptg.html View File

@ -13,7 +13,6 @@
<p>See what is being discussed currently at the PTG, and what's coming next.<p>
<div id="PTGsessions">
</div>
<p class="text-muted">Content on this page is being driven by room operators through the ptgbot on the #openstack-ptg IRC channel.</p>
</div>
<script id="PTGtemplate" type="text/x-handlebars-template">
@ -59,6 +58,7 @@
{{/each}}
</table>
</div>
<p class="text-muted">Content on this page is being driven by room operators through the ptgbot on the #openstack-ptg IRC channel. It was last refreshed on {{timestamp}}.</p>
</script>


+ 4
- 0
ptgbot/db.py View File

@ -16,6 +16,7 @@
import json
import os
import datetime
class PTGDataBase():
@ -30,6 +31,7 @@ class PTGDataBase():
self.data = json.load(fp)
else:
self.data = self.BASE
self.save()
def add_now(self, room, session):
self.data['now'][room] = session
@ -76,5 +78,7 @@ class PTGDataBase():
def save(self):
if self.ethercalc:
self.data['ethercalc'] = self.ethercalc.load()
timestamp = datetime.datetime.now()
self.data['timestamp'] = '{:%Y-%m-%d %H:%M:%S}'.format(timestamp)
with open(self.filename, 'w') as fp:
json.dump(self.data, fp)

Loading…
Cancel
Save