diff --git a/app.rb b/app.rb index b0eb111..c6fe0a8 100644 --- a/app.rb +++ b/app.rb @@ -8,23 +8,15 @@ set :database_file, 'config/database.yml' Time.now.utc.localtime("-04:00") get '/' do - @down_everage = Rate.average(:download) - @up_everage = Rate.average(:upload) - - @max_download = Rate.extremes(:maximum, :download) - @min_download = Rate.extremes(:minimum, :download) - @max_upload = Rate.extremes(:maximum, :upload) - @min_upload = Rate.extremes(:minimum, :upload) - - @data = [ - { - 'name': 'Download Rate', - 'data': Rate.transfer('download') - }, - { - 'name': 'Upload Rate', - 'data': Rate.transfer('upload') - }, + @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 diff --git a/views/home.erb b/views/home.erb index 789bdc2..85c9061 100644 --- a/views/home.erb +++ b/views/home.erb @@ -1,17 +1,3 @@

Data Transfer Test

-
-

Everage:

- Download: <%= @down_everage %> Mbps - Upload: <%= @up_everage %> Mbps -
-
-

Maximum:

- Download: <%= @max_download %> Mbps - Upload: <%= @max_upload %> Mbps -
-
-

Minimum:

- Download: <%= @min_download %> Mbps - Upload: <%= @min_upload %> Mbps -
-<%= bar_chart @data, xtitle: "Datetime", ytitle: "Rate", id: "users-chart", height: "700px" %> \ No newline at end of file +<%= bar_chart @transfer_rate, xtitle: "Rate", ytitle: "Datetime", id: "rate_transfer-chart", height: "700px" %> +<%= column_chart @download_rate, xtitle: "Datetime", ytitle: "Rate", id: "download_rate-chart", height: "700px" %> \ No newline at end of file