Merge pull request #47 from ZeusWPI/fix-charting-library

Host the charting library ourselves instead of from Google
This commit is contained in:
Wout Schellaert 2019-04-14 21:46:59 +02:00 committed by GitHub
commit fe9458dc5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -22,6 +22,8 @@
//= require react
//= require react_ujs
//= require components
//= require Chart.bundle
//= require chartkick
//= require_tree .
ready = function() {

View file

@ -12,7 +12,7 @@ class Statistics < Rails::Application
def shamehash
none_shaming = total_debt + shameful_users.sum(:balance)
shameful_users.inject({'Reputable users' => none_shaming.to_f / total_debt}) do |h, u|
h.merge({u.name => - u.balance.to_f / total_debt})
h.merge({u.name => - u.balance.to_f / total_debt * 100.0})
end
end
@ -31,4 +31,3 @@ class Statistics < Rails::Application
.take([shameful_users.count, 4].max)
end
end

View file

@ -1,5 +1,4 @@
%h1.columns-title Tab
= javascript_include_tag "//www.google.com/jsapi", "chartkick"
.pure-g.landing_columns
.pure-u-1.pure-u-md-1-2
%h2 Authentication
@ -7,4 +6,4 @@
%p= link_to "Log in met Zeus WPI", user_zeuswpi_omniauth_authorize_path, class: "pure-button pure-button-primary login-button"
.pure-u-1.pure-u-md-1-2
%h2 Pie of Shame
= pie_chart @statistics.shamehash
= pie_chart @statistics.shamehash, suffix: '%'