diff --git a/app/stats.rb b/app/stats.rb index f3868a8b..02101bd9 100644 --- a/app/stats.rb +++ b/app/stats.rb @@ -2,6 +2,8 @@ get '/stats/?' do # expires 14400, :public, :must_revalidate if self.class.production? # 4 hours @stats = { + total_hosted_site_hits: DB['SELECT SUM(hits) FROM sites'].first[:sum], + total_hosted_site_views: DB['SELECT SUM(views) FROM sites'].first[:sum], total_sites: Site.count, total_unbanned_sites: Site.where(is_banned: false).count, total_banned_sites: Site.where(is_banned: true).count, diff --git a/ext/numeric.rb b/ext/numeric.rb index 347c7178..88535856 100644 --- a/ext/numeric.rb +++ b/ext/numeric.rb @@ -21,6 +21,10 @@ class Numeric end end + def to_comma_separated + self.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(",").reverse + end + def format_large_number if self > 9999 if self > 999999999 @@ -33,7 +37,7 @@ class Numeric unit_char = 'K' #thousand unit_amount = 1000.0 end - + self_divided = self.to_f / unit_amount self_rounded = self_divided.round(1) diff --git a/views/stats.erb b/views/stats.erb index 5a435cd7..a7f2f8d9 100644 --- a/views/stats.erb +++ b/views/stats.erb @@ -6,7 +6,7 @@
-

Why our finances are open

+

Why our growth statistics and finances are open

Neocities is an Open Company startup, and are committed to openness as a defining element in how we create value. @@ -17,11 +17,11 @@

- Despite this, most companies today still treat their backend infrastructure and business finances as proprietary. The result is an erosion of user trust, where users become dependant on proprietary services that have bugs they can't help fix, financial sustainability problems they can't discover, and limitations they can't understand. We believe this is the biggest problem facing startups today. + Despite this, most companies today still treat their backend infrastructure and business operations as proprietary. The result is an erosion of user trust, where users become dependant on proprietary services that have bugs they can't help fix, financial sustainability problems they can't discover, and limitations they can't understand. We believe this is the biggest problem facing startups today.

- We do not feel that opening of our finances is as risky as is currently believed, and that the increased trust we gain from doing it more than makes up for the risk. So we have decided to open our finances. + We do not feel that opening of our finances is as risky as is currently believed, and that the increased trust we gain from doing it more than makes up for the risk. So we have decided to open our growth statistics and finances.

@@ -29,7 +29,7 @@

- Note that we do not disclose everything publicly. For example, we do not reveal the locations of our servers, the identities of our users, investors (if they choose to be anonymous) or any salaries or dividends we choose to issue. There are very legitimate security and privacy considerations to consider when providing open data, and we understand and respect that. + Note that we do not disclose everything publicly. For example, we do not currently reveal the locations of our servers, the identities of our users, investors (if they choose to be anonymous) or any salaries or dividends (in our case, member ownership percentages) we choose to issue. There are very legitimate security and privacy considerations to consider when providing open data, and we understand and respect that.

@@ -40,7 +40,15 @@ - + + + + + + + + +
Total SitesTotal Hits (sites hosted on Neocities)<%= @stats[:total_hosted_site_hits].to_comma_separated %>
Total Views (sites hosted on Neocities)<%= @stats[:total_hosted_site_views].to_comma_separated %>
Total Sites <%= @stats[:total_sites] %>