Skip to content

Commit

Permalink
Separate orgs with no listed leaders
Browse files Browse the repository at this point in the history
This will filter orgs with no listed leaders
and put them at the bottom of the page

Closes coala#17
  • Loading branch information
tioirawan committed Dec 7, 2017
1 parent a6762c4 commit 3bb48aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
9 changes: 8 additions & 1 deletion generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
)
28 changes: 26 additions & 2 deletions templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1>Google Code-in 2017 Current Leaders</h1>
The leading participants for each organization are listed randomly.
</i>
<div class="orgs">
{{#orgs}}
{{#withLeader}}
<div class="org">
<h3>
<a href="https://codein.withgoogle.com/organizations/{{slug}}">
Expand All @@ -47,8 +47,32 @@ <h3>
{{/leaders}}
</ul>
</div>
{{/orgs}}
{{/withLeader}}
</div>
{{#noLeader.length}}
<h3>Organization(s) with no listed leaders</h3>
<hr>
<div class="orgs">
{{#noLeader}}
<div class="org">
<h3>
<a href="https://codein.withgoogle.com/organizations/{{slug}}">
{{name}}
</a>
<p>Task Completed: {{completed_task_instance_count}}</p>
{{#github}}
<a href="https://github.com/{{github}}">
<img
src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png"
height="18"
/>
</a>
{{/github}}
</h3>
</div>
{{/noLeader}}
</div>
{{/noLeader.length}}
<footer>
<small>Google Code-in and the Google Code-in logo are trademarks of Google Inc.</small>
</footer>
Expand Down

0 comments on commit 3bb48aa

Please sign in to comment.