diff --git a/Dockerfile b/Dockerfile index 8f90833..88a44ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7.4 +FROM ruby:3.2 RUN apt-get update && apt-get install -y \ curl \ diff --git a/Gemfile.lock b/Gemfile.lock index 1c9b857..ec146e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ GEM remote: https://rubygems.org/ specs: - activemodel (6.1.6.1) - activesupport (= 6.1.6.1) - activerecord (6.1.6.1) - activemodel (= 6.1.6.1) - activesupport (= 6.1.6.1) - activesupport (6.1.6.1) + activemodel (6.1.7.1) + activesupport (= 6.1.7.1) + activerecord (6.1.7.1) + activemodel (= 6.1.7.1) + activesupport (= 6.1.7.1) + activesupport (6.1.7.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -16,26 +16,27 @@ GEM chronic (0.10.2) concurrent-ruby (1.1.10) ffi (1.15.4) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.11.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + mini_mime (1.1.2) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0901) - minitest (5.16.2) + minitest (5.17.0) multi_xml (0.6.0) mustermann (2.0.2) ruby2_keywords (~> 0.0.1) nio4r (2.5.8) puma (5.6.4) nio4r (~> 2.0) - rack (2.2.4) rack-protection (2.2.3) + rack (2.2.6.4) rack rake (13.0.6) rb-fsevent (0.11.0) @@ -56,11 +57,11 @@ GEM httparty (~> 0.13) sqlite3 (1.4.2) tilt (2.0.11) - tzinfo (2.0.4) + tzinfo (2.0.5) concurrent-ruby (~> 1.0) whenever (1.0.0) chronic (>= 0.6.3) - zeitwerk (2.6.0) + zeitwerk (2.6.6) PLATFORMS ruby diff --git a/models/rate.rb b/models/rate.rb index 0501559..ac346d6 100644 --- a/models/rate.rb +++ b/models/rate.rb @@ -21,6 +21,14 @@ class Rate < ActiveRecord::Base where(created_at: Date.today.all_day) end + def self.last_time + self.transfer('download').last.first + end + + def self.last_value(type) + self.transfer(type).last.last + end + def self.save test = Speedtest::Test.new(debug: false) result = test.run diff --git a/public/style.css b/public/style.css index 3d5a568..c03b655 100644 --- a/public/style.css +++ b/public/style.css @@ -22,4 +22,8 @@ section { canvas { margin-top: 15px; +} + +.lastcheck { + margin-right: 20px !important; } \ No newline at end of file diff --git a/views/home.erb b/views/home.erb index 0b96d15..6180c62 100644 --- a/views/home.erb +++ b/views/home.erb @@ -1,5 +1,12 @@

Data Transfer Test

+
+

Last Check

+
<%= Rate.last_time %>
+ Download: <%= Rate.last_value('download') %> + Upload: <%= Rate.last_value('upload') %> +
+

Transfer Rate