diff --git a/app/models/repository_time_value.rb b/app/models/repository_time_value.rb index bb020f1e6..58ffa2bcd 100644 --- a/app/models/repository_time_value.rb +++ b/app/models/repository_time_value.rb @@ -14,19 +14,19 @@ class RepositoryTimeValue < RepositoryDateTimeValueBase parameters = filter_element.parameters case filter_element.operator when 'equal_to' - repository_rows.where(repository_date_time_values: { data: parameters['time'] }) + repository_rows.where('repository_date_time_values.data::time = ?', parameters['time']) when 'unequal_to' - repository_rows.where.not(repository_date_time_values: { data: parameters['time'] }) + repository_rows.where.not('repository_date_time_values.data::time = ?', parameters['time']) when 'greater_than' - repository_rows.where('repository_date_time_values.data > ?', parameters['time']) + repository_rows.where('repository_date_time_values.data::time > ?', parameters['time']) when 'greater_than_or_equal_to' - repository_rows.where('repository_date_time_values.data >= ?', parameters['time']) + repository_rows.where('repository_date_time_values.data::time >= ?', parameters['time']) when 'less_than' - repository_rows.where('repository_date_time_values.data < ?', parameters['time']) + repository_rows.where('repository_date_time_values.data::time < ?', parameters['time']) when 'less_than_or_equal_to' - repository_rows.where('repository_date_time_values.data =< ?', parameters['time']) + repository_rows.where('repository_date_time_values.data::time <= ?', parameters['time']) when 'between' - repository_rows.where('repository_date_time_values.data > ? AND repository_date_time_values.data < ?', + repository_rows.where('repository_date_time_values.data::time > ? AND repository_date_time_values.data::time < ?', parameters['start_time'], parameters['end_time']) else raise ArgumentError, 'Wrong operator for RepositoryTimeValue!' diff --git a/app/services/repository_datatable_service.rb b/app/services/repository_datatable_service.rb index ee8b3b7d1..97b0797bb 100644 --- a/app/services/repository_datatable_service.rb +++ b/app/services/repository_datatable_service.rb @@ -204,7 +204,7 @@ class RepositoryDatatableService when 'less_than' repository_rows.where('created_at < ?', filter_element_params.dig(:parameters, :datetime)) when 'less_than_or_equal_to' - repository_rows.where('created_at =< ?', filter_element_params.dig(:parameters, :datetime)) + repository_rows.where('created_at <= ?', filter_element_params.dig(:parameters, :datetime)) when 'between' repository_rows.where('created_at > ? AND created_at < ?', filter_element_params.dig(:parameters, :start_datetime),