chore: start adding overview page

This commit is contained in:
Nelson Jovel 2024-01-17 12:49:23 -08:00
parent 1b0af124f7
commit 64b4d599c7
33 changed files with 783 additions and 199 deletions

View 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

View 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

View file

@ -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