Created
December 19, 2016 07:10
-
-
Save saveroo/d69b222e084f4dc7e17d7468c4867701 to your computer and use it in GitHub Desktop.
multiternary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@units = Unit.where(id: @unit_discount.map(&:unit_id) + @search.result.pluck(:unit_id) + | |
(params[:q].present? ? AvailabilityFact.where(vendor_id: @vendor.id) | |
.all_unit_inventory_at(Date.new(params[:q]['valid_date_gteq(1i)'].to_i, params[:q]['valid_date_gteq(2i)'].to_i, params[:q]['valid_date_gteq(3i)'].to_i), | |
Date.new(params[:q]['valid_date_lteq(1i)'].to_i, params[:q]['valid_date_lteq(2i)'].to_i, params[:q]['valid_date_lteq(3i)'].to_i)).pluck(:unit_id) : [])) | |
.where { id << hidden_unit }.includes(:stock, variant: :product).joins(variant: :product).order('products.name ASC').page(params[:page]).per_page(50) | |
if params[:q] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment