diff --git a/app/controllers/synced_transactions_controller.rb b/app/controllers/synced_transactions_controller.rb index a888354..817cc2d 100644 --- a/app/controllers/synced_transactions_controller.rb +++ b/app/controllers/synced_transactions_controller.rb @@ -5,9 +5,11 @@ def index sort = params[:sort].presence || "event_time" sort_type = params[:sort_type].presence || "desc" @symbol = params[:search] + @source = params[:tx_source] txs = SyncedTransaction.where(user_id: nil) @total_symbols = txs.pluck(:origin_symbol).uniq txs = txs.where(origin_symbol: @symbol) if @symbol.present? + txs = txs.where(source: @source) if @source.present? txs = txs.available if @flag parts = txs.partition {|h| h.send("#{sort}").nil? || h.send("#{sort}") == 'N/A'} @txs = parts.last.sort_by{|h| h.send("#{sort}")} + parts.first diff --git a/app/views/synced_transactions/index.html.erb b/app/views/synced_transactions/index.html.erb index 4741a08..a7ec4e9 100644 --- a/app/views/synced_transactions/index.html.erb +++ b/app/views/synced_transactions/index.html.erb @@ -6,9 +6,12 @@
- <%= form_tag synced_transactions_path, id: "search_targets", class: "position-relative", method: "GET" do %> -
+ <%= form_tag synced_transactions_path, id: "search_targets", method: "GET" do %> +
<%= select_tag(:search, options_for_select(@total_symbols, @symbol), { prompt: '请选择币种...', class: 'select2-dropdown form-control' }) %> + + <%= select_tag(:tx_source, options_for_select(['binance', 'okx'], @source),{ prompt: '请选择来源...', class: 'select2-dropdown form-control'}) %> + <%= link_to "Reset", synced_transactions_path, class: 'btn btn-warning' %>