Skip to content

Commit

Permalink
Fix budget
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Sep 8, 2020
1 parent 2900f97 commit d048459
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ ${text.trim()}
return commaNumber(num);
});

eleventyConfig.addFilter("displayPrice", function(num) {
return parseFloat(num).toFixed(2);
});

eleventyConfig.addShortcode("templatelangs", function(languages, page, whitelist, anchor, isinline) {
let parentTag = isinline ? "span" : "ul";
let childTag = isinline ? "span" : "li";
Expand Down
2 changes: 1 addition & 1 deletion _data/opencollectiveMonthly.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = async function() {
recurringAmount: monthlyDonations,
stats: {
median: sorted[Math.floor(sorted.length / 2)],
mean: (monthlyDonations / count).toFixed(2),
mean: monthlyDonations / count,
},
list: sorted,
buckets: buckets,
Expand Down
8 changes: 4 additions & 4 deletions budget.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ layout: layouts/main.njk

## Current recurring monthly donations

<p style="font-size: 3em"><code>${{ opencollectiveMonthly.recurringAmount }}</code></p>
<p style="font-size: 3em"><code>${{ opencollectiveMonthly.recurringAmount | displayPrice }}</code></p>

_Monthly donations:_

{%- for donation,count in opencollectiveMonthly.buckets %}
* `${{ donation }}` ×{{ count }}
{%- endfor %}

_Median monthly donation:_ `${{ opencollectiveMonthly.stats.median }}`
_Mean monthly donation:_ `${{ opencollectiveMonthly.stats.mean }}`
_Median monthly donation:_ `${{ opencollectiveMonthly.stats.median | displayPrice }}`
_Mean monthly donation:_ `${{ opencollectiveMonthly.stats.mean | displayPrice }}`

## Yearly estimate

<p style="font-size: 3em"><code>${{ opencollectiveMonthly.recurringAmount * 12 }}</code></p>
<p style="font-size: 3em"><code>${{ (opencollectiveMonthly.recurringAmount * 12) | displayPrice }}</code></p>

_The monthly amount ×12_ 😇

0 comments on commit d048459

Please sign in to comment.