diff --git a/app/models/repository_time_range_value.rb b/app/models/repository_time_range_value.rb index 5c323e966..be07a7bca 100644 --- a/app/models/repository_time_range_value.rb +++ b/app/models/repository_time_range_value.rb @@ -18,22 +18,22 @@ class RepositoryTimeRangeValue < RepositoryDateTimeRangeValueBase case filter_element.operator when 'equal_to' repository_rows.where("#{join_alias}.start_time::time = (?)::time AND #{join_alias}.end_time::time = (?)::time", - parameters['start_time'], parameters['end_time']) + Time.zone.parse(parameters['start_time']), Time.zone.parse(parameters['end_time'])) when 'unequal_to' repository_rows .where.not("#{join_alias}.start_time::time = (?)::time AND #{join_alias}.end_time::time = (?)::time", - parameters['start_time'], parameters['end_time']) + Time.zone.parse(parameters['start_time']), Time.zone.parse(parameters['end_time'])) when 'greater_than' - repository_rows.where("#{join_alias}.start_time::time > (?)::time", parameters['end_time']) + repository_rows.where("#{join_alias}.start_time::time > (?)::time", Time.zone.parse(parameters['end_time'])) when 'greater_than_or_equal_to' - repository_rows.where("#{join_alias}.start_time::time >= (?)::time", parameters['end_time']) + repository_rows.where("#{join_alias}.start_time::time >= (?)::time", Time.zone.parse(parameters['end_time'])) when 'less_than' - repository_rows.where("#{join_alias}.end_time::time < (?)::time", parameters['start_time']) + repository_rows.where("#{join_alias}.end_time::time < (?)::time", Time.zone.parse(parameters['start_time'])) when 'less_than_or_equal_to' - repository_rows.where("#{join_alias}.end_time::time <= (?)::time", parameters['start_time']) + repository_rows.where("#{join_alias}.end_time::time <= (?)::time", Time.zone.parse(parameters['start_time'])) when 'between' repository_rows.where("#{join_alias}.start_time::time > (?)::time AND #{join_alias}.end_time::time < (?)::time", - parameters['start_time'], parameters['end_time']) + Time.zone.parse(parameters['start_time']), Time.zone.parse(parameters['end_time'])) else raise ArgumentError, 'Wrong operator for RepositoryTimeRangeValue!' end diff --git a/app/models/repository_time_value.rb b/app/models/repository_time_value.rb index ada085fee..eff2c232a 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("#{join_alias}.data::time = ?", Time.zone.parse(parameters['time'])) + repository_rows.where("#{join_alias}.data::time = (?)::time", Time.zone.parse(parameters['time'])) when 'unequal_to' - repository_rows.where.not("#{join_alias}.data::time = ?", Time.zone.parse(parameters['time'])) + repository_rows.where.not("#{join_alias}.data::time = (?)::time", Time.zone.parse(parameters['time'])) when 'greater_than' - repository_rows.where("#{join_alias}.data::time > ?", Time.zone.parse(parameters['time'])) + repository_rows.where("#{join_alias}.data::time > (?)::time", Time.zone.parse(parameters['time'])) when 'greater_than_or_equal_to' - repository_rows.where("#{join_alias}.data::time >= ?", Time.zone.parse(parameters['time'])) + repository_rows.where("#{join_alias}.data::time >= (?)::time", Time.zone.parse(parameters['time'])) when 'less_than' - repository_rows.where("#{join_alias}.data::time < ?", Time.zone.parse(parameters['time'])) + repository_rows.where("#{join_alias}.data::time < (?)::time", Time.zone.parse(parameters['time'])) when 'less_than_or_equal_to' - repository_rows.where("#{join_alias}.data::time <= ?", Time.zone.parse(parameters['time'])) + repository_rows.where("#{join_alias}.data::time <= (?)::time", Time.zone.parse(parameters['time'])) when 'between' - repository_rows.where("#{join_alias}.data::time > ? AND #{join_alias}.data::time < ?", + repository_rows.where("#{join_alias}.data::time > (?)::time AND #{join_alias}.data::time < (?)::time", Time.zone.parse(parameters['start_time']), Time.zone.parse(parameters['end_time'])) else raise ArgumentError, 'Wrong operator for RepositoryTimeValue!'