mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-15 20:11:22 +08:00
Fix date filtering for global search [SCI-10710]
This commit is contained in:
parent
c78f7dd56a
commit
284813c655
1 changed files with 3 additions and 3 deletions
|
@ -232,11 +232,11 @@ class SearchController < ApplicationController
|
|||
if @filters[attribute][:on].present?
|
||||
from_date = Time.zone.parse(@filters[attribute][:on]).beginning_of_day.utc
|
||||
to_date = Time.zone.parse(@filters[attribute][:on]).end_of_day.utc
|
||||
elsif @filters[attribute][:from].present? && @filters[attribute][:to].present?
|
||||
from_date = Time.zone.parse(@filters[attribute][:from])
|
||||
to_date = Time.zone.parse(@filters[attribute][:to])
|
||||
end
|
||||
|
||||
from_date = Time.zone.parse(@filters[attribute][:from]) if @filters[attribute][:from].present?
|
||||
to_date = Time.zone.parse(@filters[attribute][:to]) if @filters[attribute][:to].present?
|
||||
|
||||
@records = @records.where("#{model_name}.#{attribute} >= ?", from_date) if from_date.present?
|
||||
@records = @records.where("#{model_name}.#{attribute} <= ?", to_date) if to_date.present?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue