Added last value
This commit is contained in:
parent
01f0527a06
commit
c8c11e1e39
@ -21,6 +21,14 @@ class Rate < ActiveRecord::Base
|
|||||||
where(created_at: Date.today.all_day)
|
where(created_at: Date.today.all_day)
|
||||||
end
|
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
|
def self.save
|
||||||
test = Speedtest::Test.new(debug: false)
|
test = Speedtest::Test.new(debug: false)
|
||||||
result = test.run
|
result = test.run
|
||||||
|
@ -22,4 +22,8 @@ section {
|
|||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lastcheck {
|
||||||
|
margin-right: 20px !important;
|
||||||
}
|
}
|
@ -1,5 +1,12 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Data Transfer Test</h1>
|
<h1>Data Transfer Test</h1>
|
||||||
|
<div class="text-center">
|
||||||
|
<h2>Last Check</h2>
|
||||||
|
<div><%= Rate.last_time %></div>
|
||||||
|
Download: <%= Rate.last_value('download') %>
|
||||||
|
Upload: <%= Rate.last_value('upload') %>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<div class="row row-cols-1 row-cols-sm-1 row-cols-md-3">
|
<div class="row row-cols-1 row-cols-sm-1 row-cols-md-3">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h2 class="text-center">Transfer Rate</h2>
|
<h2 class="text-center">Transfer Rate</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user