Do not display room if not reservable on the day

Stop displaying a line for a room in "additional tracks"
if it's actually not reservable at all during that day.

Change-Id: If7063b8bf00531cd154f49c3a3fbc88b1e16fa3f
This commit is contained in:
Thierry Carrez 2018-02-02 13:30:05 +01:00
parent 3781e486f7
commit 5575015e33
2 changed files with 11 additions and 0 deletions

View File

@ -109,6 +109,7 @@
{{/each}}
</tr></thead>
{{#each @root.additional as |schedule room|}}
{{#if (roomactive schedule times)}}
<tr><td>{{room}}</td>
{{#each (lookup @root.slots day) as |time|}}
{{#if (lookup schedule time.name)}}
@ -118,6 +119,7 @@
{{/if}}
{{/each}}
</tr>
{{/if}}
{{/each}}
</table>
</div>

View File

@ -18,6 +18,15 @@ Handlebars.registerHelper('hashtag', function(options) {
return new Handlebars.SafeString(sentence);
});
Handlebars.registerHelper('roomactive', function(schedule, times) {
for (var i=0; i<times.length; i++) {
if (schedule[times[i]['name']] != undefined) {
return true;
}
}
return false;
});
Handlebars.registerHelper('roomcode', function(schedule, room, timecode) {
if (schedule[timecode] == "") {
return room + "-" + timecode;