From 8a4910d9041a5b0c058d03d0caff9fadd898b647 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Fri, 10 May 2019 11:05:10 +0100 Subject: [PATCH] Display count of attendees in each room on web page Currently it's not obvious that you can see who's checked into a room by hovering the mouse over one of the room badges. This in turn makes it less likely for people to check in, since they either won't be aware of the feature, or will forget about it. So game-ify check-ins by adding a new column to the "Current discussion topics" table which displays the number of check-ins within that room. Story: 2005657 Task: 30945 Change-Id: I8d2bc716d39c70ff096f17b4da9ccf0a26bfc34f --- html/ptg.html | 1 + html/ptg.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/html/ptg.html b/html/ptg.html index 293a56f..39f1c4a 100644 --- a/html/ptg.html +++ b/html/ptg.html @@ -41,6 +41,7 @@ {{trackbadge track}} {{#trackContentLine}}{{lookup @root.now track}}{{/trackContentLine}} {{lookup @root.location track}} + {{checkins track}} {{/if}} {{else}} diff --git a/html/ptg.js b/html/ptg.js index 69fd3e8..cc5c128 100644 --- a/html/ptg.js +++ b/html/ptg.js @@ -32,6 +32,28 @@ Handlebars.registerHelper('roomactive', return false; }); +Handlebars.registerHelper('checkins', function(track) { + var count = checkins_count(track); + var url = "https://opendev.org/openstack/ptgbot/src/branch/master/README.rst"; + var text; + var title = "See below or click for how to check in/out"; + if (count == 0) { + text = 'No check-ins'; + } else { + text = count + ' check-in' + (count == 1 ? '' : 's'); + title = checkins_tooltip(track) + ".\n\n" + title + '.'; + } + return new Handlebars.SafeString( + '' + text + '' + ); +}); + +function checkins_count(track) { + var room_checkins = checkins['#' + track]; + return room_checkins ? Object.keys(room_checkins).length : 0; +} + function checkins_tooltip(track) { var room_checkins = checkins['#' + track]; if (room_checkins) {