summaryrefslogtreecommitdiff
path: root/bin/community
diff options
context:
space:
mode:
Diffstat (limited to 'bin/community')
-rwxr-xr-xbin/community6
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