diff options
| author | mo khan <mo@mokhan.ca> | 2024-05-24 12:10:03 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2024-05-24 12:10:03 -0600 |
| commit | 9bdb91d44fe4657666a22d50b5034a82ef915ca5 (patch) | |
| tree | 0ad81b416dafa64751887f92232632729868c622 /bin | |
| parent | 92bcab3bea62f01fb2d0f82354a167ff13cc824f (diff) | |
Add percentages
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/community | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/community b/bin/community index 111846e..f7f7a3f 100755 --- a/bin/community +++ b/bin/community @@ -26,6 +26,12 @@ class Community self[:name] end + def percent(key) + return 0 if self[:res_cnt].to_i.zero? + + ((self[key].to_f / self[:res_cnt].to_f) * 100).round(1) + end + def homepage_url "https://www.calgary.ca/communities/profiles/#{name.parameterize}.html" end |
