data-transfer-test/app.rb

23 lines
616 B
Ruby
Raw Normal View History

2020-06-03 03:02:01 +00:00
require 'sinatra'
require 'sinatra/activerecord'
require 'chartkick'
require './models/rate'
set :database_file, 'config/database.yml'
Time.now.utc.localtime("-04:00")
get '/' do
2021-11-03 02:45:01 +00:00
@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)}
2020-06-03 03:02:01 +00:00
]
erb :home
end