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 = [
|
2021-11-04 01:35:11 +00:00
|
|
|
{'name': 'Download', 'data': Rate.transfer('download')},
|
|
|
|
{'name': 'Upload', 'data': Rate.transfer('upload')}
|
2021-11-03 02:45:01 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
@download_rate = [
|
2021-11-04 01:35:11 +00:00
|
|
|
{'name': 'Max', 'data': Rate.extremes(:maximum, :download)},
|
|
|
|
{'name': 'Min', 'data': Rate.extremes(:minimum, :download)},
|
|
|
|
{'name': 'Everage', 'data': Rate.extremes(:average, :download)}
|
|
|
|
]
|
2021-11-04 01:33:38 +00:00
|
|
|
|
|
|
|
@upload_rate = [
|
|
|
|
{'name': 'Max', 'data': Rate.extremes(:maximum, :upload)},
|
|
|
|
{'name': 'Min', 'data': Rate.extremes(:minimum, :upload)},
|
|
|
|
{'name': 'Everage', 'data': Rate.extremes(:average, :upload)}
|
2020-06-03 03:02:01 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
erb :home
|
|
|
|
end
|