This commit is contained in:
Adrian Hinz 2017-12-14 12:46:19 +01:00
parent 67702f0547
commit c00b5b5bb6
2 changed files with 16 additions and 0 deletions

View File

@ -29,5 +29,11 @@ class HomeController < ApplicationController
def bbt
@bbt = BitBayTrade.where('currency_id = ?', @curr_id).order('cast(tid as unsigned) DESC').limit(20)
@bbt_max_lifetime = BitBayTrade.where('currency_id = ?', @curr_id).order('price DESC').first
@bbt_min_lifetime = BitBayTrade.where('currency_id = ?', @curr_id).order('price ASC').first
time = Time.now - 24.hours
@bbt_max_24h = BitBayTrade.where('currency_id = ? AND date > ?', @curr_id,time).order('price DESC').first
@bbt_min_24h = BitBayTrade.where('currency_id = ? AND date > ?', @curr_id,time).order('price ASC').first
end
end

View File

@ -1,3 +1,13 @@
<% if !@bbt_max_lifetime.blank? %>
<h6>Max (<%= @bbt_max_lifetime.date %>): <span class="badge badge-success"><%= '%.2f' % @bbt_max_lifetime.price %></span> Min (<%= @bbt_min_lifetime.date %>): <span class="badge badge-danger"><%= '%.2f' % @bbt_min_lifetime.price %></span></h6>
<% else %>
<h6><span class="badge badge-warning">Brak danych dla tej monety</span></h6>
<% end %>
<% if !@bbt_max_24h.blank? %>
<h6>Max 24h: <span class="badge badge-success"><%= '%.2f' % @bbt_max_24h.price %></span> Min 24h: <span class="badge badge-danger"><%= '%.2f' % @bbt_min_24h.price %></span></h6>
<% else %>
<h6><span class="badge badge-danger">Brak danych z ostatnich 24h</span></h6>
<% end %>
<table class="table table-sm table-dark">
<thead>
<tr>