From 3bb48aa82eadb566af53dcdf6803777ff488aa35 Mon Sep 17 00:00:00 2001 From: indmind Date: Thu, 7 Dec 2017 14:32:57 +0700 Subject: [PATCH] Separate orgs with no listed leaders This will filter orgs with no listed leaders and put them at the bottom of the page Closes https://github.com/coala/gci-leaders/issues/17 --- generate.js | 9 ++++++++- templates/main.html | 28 ++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/generate.js b/generate.js index 4bb2988..93b7ad9 100644 --- a/generate.js +++ b/generate.js @@ -12,11 +12,18 @@ ncp('static', 'out/static', err => { } }) +const noLeader = [] +const withLeader = orgs.filter(org => { + if (!org.leaders.length) noLeader.push(org) + return org.leaders.length +}) + fs.writeFileSync( 'out/index.html', Mustache.render(fs.readFileSync('templates/main.html').toString(), { - orgs, + withLeader, datetime, rootURL, + noLeader, }) ) diff --git a/templates/main.html b/templates/main.html index 0c3737c..ff4e624 100644 --- a/templates/main.html +++ b/templates/main.html @@ -22,7 +22,7 @@

Google Code-in 2017 Current Leaders

The leading participants for each organization are listed randomly.
- {{#orgs}} + {{#withLeader}} - {{/orgs}} + {{/withLeader}}
+ {{#noLeader.length}} +

Organization(s) with no listed leaders

+
+
+ {{#noLeader}} +
+

+ + {{name}} + +

Task Completed: {{completed_task_instance_count}}

+ {{#github}} + + + + {{/github}} +

+
+ {{/noLeader}} +
+ {{/noLeader.length}}