Compare commits

...

2 commits

4 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,7 @@ class Finance::FinancialTransactionsController < ApplicationController
sort = "created_on DESC" sort = "created_on DESC"
end end
@q = FinancialTransaction.search(params[:q]) @q = FinancialTransaction.ransack(params[:q])
@financial_transactions_all = @q.result(distinct: true).includes(:user).order(sort) @financial_transactions_all = @q.result(distinct: true).includes(:user).order(sort)
@financial_transactions_all = @financial_transactions_all.visible unless params[:show_hidden] @financial_transactions_all = @financial_transactions_all.visible unless params[:show_hidden]
@financial_transactions_all = @financial_transactions_all.where(ordergroup_id: @ordergroup.id) if @ordergroup @financial_transactions_all = @financial_transactions_all.where(ordergroup_id: @ordergroup.id) if @ordergroup

View file

@ -32,8 +32,8 @@ class GroupOrder < ApplicationRecord
# Generate some data for the javascript methods in ordering view # Generate some data for the javascript methods in ordering view
def load_data def load_data
data = {} data = {}
data[:account_balance] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.account_balance data[:account_balance] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.account_balance
data[:available_funds] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.get_available_funds(self) data[:available_funds] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.get_available_funds(self)
# load prices and other stuff.... # load prices and other stuff....
data[:order_articles] = {} data[:order_articles] = {}

View file

@ -3,7 +3,7 @@ class String
# remove comma from decimal inputs # remove comma from decimal inputs
def self.delocalized_decimal(string) def self.delocalized_decimal(string)
if !string.blank? and string.is_a?(String) if !string.blank? and string.is_a?(String)
BigDecimal.new(string.sub(',', '.')) BigDecimal(string.sub(',', '.'))
else else
string string
end end

View file

@ -32,7 +32,7 @@ class CurrentOrders::ArticlesController < ApplicationController
else else
@order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id)) @order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id))
end end
@q = OrderArticle.search(params[:q]) @q = OrderArticle.ransack(params[:q])
@order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price) @order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price)
@order_article = @order_articles.where(id: params[:id]).first @order_article = @order_articles.where(id: params[:id]).first
end end