mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-15 09:45:53 -07:00
chore: start adding overview page
This commit is contained in:
parent
1b0af124f7
commit
64b4d599c7
33 changed files with 783 additions and 199 deletions
13
config/initializers/dashboard/array_monkey_patches.rb
Normal file
13
config/initializers/dashboard/array_monkey_patches.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ArrayMonkeyPatches
|
||||
def average
|
||||
sum.to_f / size
|
||||
end
|
||||
|
||||
def remove_blanks
|
||||
reject { |item| item.nil? || item.to_f.nan? || item.zero? }
|
||||
end
|
||||
end
|
||||
|
||||
Array.include ArrayMonkeyPatches
|
||||
21
config/initializers/dashboard/float_monkey_patches.rb
Normal file
21
config/initializers/dashboard/float_monkey_patches.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module FloatMonkeyPatches
|
||||
def round_up_to_one
|
||||
if positive? && self < 1
|
||||
1.0
|
||||
else
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
def round_down_to_five
|
||||
if positive? && self > 5
|
||||
5.0
|
||||
else
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Float.include FloatMonkeyPatches
|
||||
|
|
@ -1,3 +1,10 @@
|
|||
Dashboard::Engine.routes.draw do
|
||||
resources :districts do
|
||||
resources :schools, only: %i[index show] do
|
||||
resources :overview, only: [:index]
|
||||
# resources :categories, only: [:show], path: "browse"
|
||||
# resources :analyze, only: [:index]
|
||||
end
|
||||
end
|
||||
get "/welcome", to: "home#index"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue