paxful_engine-rails 0.6.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a8eb298ea0c209e4536008d41eaea8d8f8290ebe238bf4c4788d2fcb79dc81a
4
- data.tar.gz: d1875e3a006fed12babdc0c60d1bd88601de09358067def092511f2853beb7a1
3
+ metadata.gz: 6bf1b3bb282e90310c4c06163a3d0b0fbd7362b08608490811271abf7f7e89f8
4
+ data.tar.gz: 68d2cb65f3051c6fefa6c5c209fca6d826b695886ef4663d204fca4a3b3df376
5
5
  SHA512:
6
- metadata.gz: 4300ebed063c0ea02f589c79014dcab945eb0b626b307a375c5c7579661f6824ebdd9f4dea60b6bd457342018e9bd2ca0ccdb90a7a3d0410971c2e29b18d2ab5
7
- data.tar.gz: ed060a7c6d0ef44422186eb219bba05ba8c2abd605d3511205caea16add0b7c5ba9bc9c9da76e1b280cdde969f791bbe3b0cbfb8cf37b25d46230aec761e4929
6
+ metadata.gz: a5b79681193267cc5b095b7b26249d11aa2fc4c36ae67c77d88c9d8d9ad5f2c4986c4f5ee10c83af54b113da4efb1d7240b11b198f070f93af2b5eae4cb03759
7
+ data.tar.gz: 83e3ac9112667ead30807ed1d16a12d503517f8f29fd6a58671849e9b90b30fac47b142cc649611fb6987e2a5cb5c0f9fdf52248f115c94e303ea0bcfb0331db
@@ -2,7 +2,11 @@ module PaxfulEngine
2
2
  class TradesController < ApplicationController
3
3
 
4
4
  def index
5
- @trades = Trade.all
5
+ @trades = Trade.order(completed_at: :desc, created_at: :desc)
6
+
7
+ if params[:q] != "all"
8
+ @trades = @trades.where.not(completed_at: nil)
9
+ end
6
10
  end
7
11
 
8
12
  def show
@@ -6,5 +6,10 @@ module PaxfulEngine
6
6
  status == "successful" ? "text-success" : "text-danger"
7
7
  end
8
8
 
9
+ def format_datetime(datetime, timezone = "Asia/Manila")
10
+ return "-" if datetime.nil?
11
+ datetime.in_time_zone(timezone).strftime("%m/%d/%Y %I:%M%p")
12
+ end
13
+
9
14
  end
10
15
  end
@@ -29,5 +29,9 @@ module PaxfulEngine
29
29
  offer_type.downcase == "sell"
30
30
  end
31
31
 
32
+ def base_crypto_requested
33
+ BigDecimal(crypto_amount_requested) / 100_000_000
34
+ end
35
+
32
36
  end
33
37
  end
@@ -1,16 +1,25 @@
1
- <span class="font-weight-bold"> Found <%= pluralize(@trades.count, "trade") %></span>
1
+ <span class="font-weight-bold"> Found <%= pluralize(@trades.count, "trade") %>.</span>
2
+
3
+ <div>
4
+ <% if params[:q] == "all" %>
5
+ <%= link_to "👀 Only show successful trades", trades_path %>
6
+ <% else %>
7
+ <%= link_to "👀 Include non-successful trades", trades_path(q: :all) %>
8
+ <% end %>
9
+ </div>
10
+
2
11
  <hr />
3
12
 
4
13
  <div class="table-responsive">
5
14
  <table class="table table-striped table-bordered">
6
15
  <thead>
7
16
  <tr>
8
- <th scope="col">Created</th>
17
+ <th scope="col">Completed Date</th>
9
18
  <th scope="col">Trade hash</th>
19
+ <th scope="col">Fiat</th>
20
+ <th scope="col">Crypto</th>
10
21
  <th scope="col">Type</th>
11
22
  <th scope="col">Status</th>
12
- <th scope="col">Seller</th>
13
- <th scope="col">Buyer</th>
14
23
  <th scope="col"></th>
15
24
  </tr>
16
25
  </thead>
@@ -23,14 +32,14 @@
23
32
 
24
33
  <% @trades.each do |trade| %>
25
34
  <tr scope="row">
26
- <td> <%= trade.created_at.strftime("%m/%d/%Y %I:%M%p") %> </td>
35
+ <td> <%= format_datetime(trade.completed_at) %> </td>
27
36
  <td> <%= trade.trade_hash %> </td>
37
+ <td> <%= number_to_currency(trade.fiat_amount_requested, unit: "#{trade.fiat_currency_code} ") %> </td>
38
+ <td> <%= trade.crypto_currency_code %> <%= trade.base_crypto_requested %> </td>
28
39
  <td> <%= trade.offer_type.upcase %> </td>
29
40
  <td>
30
41
  <span class="<%= highlight_status(trade) %>"> <%= trade.status.upcase %> </span>
31
42
  </td>
32
- <td> <%= trade.seller %> </td>
33
- <td> <%= trade.buyer %> </td>
34
43
  <td> <%= link_to "Check trade details", paxful_engine.trade_path(trade) %> </td>
35
44
  </tr>
36
45
  <% end %>
@@ -20,17 +20,26 @@
20
20
  </div>
21
21
  <div>
22
22
  <strong>Crypto Requested:</strong>
23
- <%= number_to_currency(@trade.crypto_amount_requested, unit: "#{@trade.crypto_currency_code} ") %>
24
- (in sats)
23
+ <%= @trade.crypto_currency_code %> <%= @trade.base_crypto_requested %>
24
+ (<%= number_to_currency(@trade.crypto_amount_requested, unit: "") %> in sats)
25
25
  </div>
26
26
  </div>
27
27
 
28
28
  <hr />
29
29
 
30
30
  <div>
31
- <div> <strong>Started at:</strong> <%= @trade.started_at.strftime("%m/%d/%Y %I:%M%p") %> </div>
32
- <div> <strong>Ended at:</strong> <%= @trade.ended_at.strftime("%m/%d/%Y %I:%M%p") %> </div>
33
- <div> <strong>Completed at:</strong> <%= @trade.completed_at&.strftime("%m/%d/%Y %I:%M%p") %> </div>
31
+ <div>
32
+ <strong>Started at:</strong>
33
+ <%= format_datetime(@trade.started_at) %>
34
+ </div>
35
+ <div>
36
+ <strong>Ended at:</strong>
37
+ <%= format_datetime(@trade.ended_at) %>
38
+ </div>
39
+ <div>
40
+ <strong>Completed at:</strong>
41
+ <%= format_datetime(@trade.completed_at) %>
42
+ </div>
34
43
  </div>
35
44
 
36
45
  <hr />
@@ -1,3 +1,3 @@
1
1
  module PaxfulEngine
2
- VERSION = '0.6.0'
2
+ VERSION = '0.9.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paxful_engine-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config