From 9bdb91d44fe4657666a22d50b5034a82ef915ca5 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 24 May 2024 12:10:03 -0600 Subject: Add percentages --- bin/community | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin') 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 -- cgit v1.2.3