mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Fix added on this month filter [SCI-6584] (#3904)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
155b437d6a
commit
99e8f7e3cb
1 changed files with 13 additions and 13 deletions
|
@ -202,7 +202,7 @@ class RepositoryDatatableService
|
|||
)
|
||||
when 'this_month'
|
||||
repository_rows.where(
|
||||
"date_trunc('minute', \"created_at\") >= ? AND date_trunc('minute', \"created_at\") <= ?",
|
||||
"date_trunc('minute', \"repository_rows\".\"created_at\") >= ? AND date_trunc('minute', \"repository_rows\".\"created_at\") <= ?",
|
||||
Time.zone.now.beginning_of_month,
|
||||
Time.zone.now.end_of_month
|
||||
)
|
||||
|
@ -254,22 +254,22 @@ class RepositoryDatatableService
|
|||
|
||||
case filter_element_params[:operator]
|
||||
when 'today'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") >= ? AND date_trunc('minute', \"archived_on\") <= ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") >= ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") <= ?",
|
||||
Time.zone.now.beginning_of_day, Time.zone.now.end_of_day)
|
||||
when 'yesterday'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") >= ? AND date_trunc('minute', \"archived_on\") < ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") >= ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") < ?",
|
||||
Time.zone.now.beginning_of_day - 1.day, Time.zone.now.beginning_of_day)
|
||||
when 'last_week'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") >= ? AND date_trunc('minute', \"archived_on\") < ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") >= ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") < ?",
|
||||
Time.zone.now.beginning_of_week - 1.week, Time.zone.now.beginning_of_week)
|
||||
when 'this_month'
|
||||
repository_rows.where(
|
||||
"date_trunc('minute', \"archived_on\") >= ? AND date_trunc('minute', \"archived_on\") <= ?",
|
||||
"date_trunc('minute', \"repository_rows\".\"archived_on\") >= ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") <= ?",
|
||||
Time.zone.now.beginning_of_month,
|
||||
Time.zone.now.end_of_month
|
||||
)
|
||||
when 'last_year'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") >= ? AND date_trunc('minute', \"archived_on\") < ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") >= ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") < ?",
|
||||
Time.zone.now.beginning_of_year - 1.year, Time.zone.now.beginning_of_year)
|
||||
when 'this_year'
|
||||
repository_rows.where(
|
||||
|
@ -279,25 +279,25 @@ class RepositoryDatatableService
|
|||
Time.zone.now.end_of_year
|
||||
)
|
||||
when 'equal_to'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") = ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") = ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'unequal_to'
|
||||
repository_rows.where.not("date_trunc('minute', \"archived_on\") = ?",
|
||||
repository_rows.where.not("date_trunc('minute', \"repository_rows\".\"archived_on\") = ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'greater_than'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") > ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") > ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'greater_than_or_equal_to'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") >= ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") >= ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'less_than'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") < ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") < ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'less_than_or_equal_to'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") <= ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") <= ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :datetime)))
|
||||
when 'between'
|
||||
repository_rows.where("date_trunc('minute', \"archived_on\") > ? AND date_trunc('minute', \"archived_on\") < ?",
|
||||
repository_rows.where("date_trunc('minute', \"repository_rows\".\"archived_on\") > ? AND date_trunc('minute', \"repository_rows\".\"archived_on\") < ?",
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :start_datetime)),
|
||||
Time.zone.parse(filter_element_params.dig(:parameters, :end_datetime)))
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue