Sort room list
This provides a sorting of the room list by iterating the total list of rooms, and displaying information per room if available. Without this the order of rooms jumps on each save based on the fact that it's a dict/object and has no natural sort order. That can feel very confusing. Change-Id: I5375374091296cd7c23a3a8e2272aefcf6b2d896
This commit is contained in:
parent
fd98e5db9a
commit
f2af689e52
@ -27,12 +27,14 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">Currently playing...</h3></div>
|
||||
<table class="table">
|
||||
{{#each now as |what room|}}
|
||||
{{#each rooms as |room| }}
|
||||
{{#if (lookup @root.now room) }}
|
||||
<tr>
|
||||
<td class="col-sm-1"><span class="label label-primary {{room}}">{{room}}</span></td>
|
||||
<td>{{#hashtag}}{{what}}{{/hashtag}}</td>
|
||||
<td>{{#hashtag}}{{lookup @root.now room}}{{/hashtag}}</td>
|
||||
<td>{{lookup @root.location room}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<tr><td><small><i>Nothing yet</i></small><td></tr>
|
||||
{{/each}}
|
||||
@ -41,15 +43,17 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">Coming up next...</h3></div>
|
||||
<table class="table">
|
||||
{{#each next as |sessions room|}}
|
||||
{{#each rooms as |room| }}
|
||||
{{#if (lookup @root.next room) }}
|
||||
<tr>
|
||||
<td class="col-sm-1"><span class="label label-primary {{room}}">{{room}}</span></td>
|
||||
<td>
|
||||
{{#each sessions}}
|
||||
{{#hashtag}}{{this}}{{/hashtag}}<br/>
|
||||
{{/each}}
|
||||
{{#each (lookup @root.next room) as |item|}}
|
||||
{{#hashtag}}{{item}}{{/hashtag}} <br/>
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<tr><td><small><i>Nothing yet</i></small><td></tr>
|
||||
{{/each}}
|
||||
|
@ -91,5 +91,6 @@ class PTGDataBase():
|
||||
self.data['ethercalc'] = self.ethercalc.load()
|
||||
timestamp = datetime.datetime.now()
|
||||
self.data['timestamp'] = '{:%Y-%m-%d %H:%M:%S}'.format(timestamp)
|
||||
self.data['rooms'] = sorted(self.data['rooms'])
|
||||
with open(self.filename, 'w') as fp:
|
||||
json.dump(self.data, fp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user