data-transfer-test/app.rb
2021-11-02 22:45:23 -04:00

23 lines
616 B
Ruby

require 'sinatra'
require 'sinatra/activerecord'
require 'chartkick'
require './models/rate'
set :database_file, 'config/database.yml'
Time.now.utc.localtime("-04:00")
get '/' do
@transfer_rate = [
{'name': 'Download Rate', 'data': Rate.transfer('download')},
{'name': 'Upload Rate', 'data': Rate.transfer('upload')}
]
@download_rate = [
{'name': 'Max Download Rate', 'data': Rate.extremes(:maximum, :download)},
{'name': 'Min Download Rate', 'data': Rate.extremes(:minimum, :download)},
{'name': 'Everage Download Rate', 'data': Rate.extremes(:average, :download)}
]
erb :home
end