diff options
| author | cedricnjanga | 2017-10-03 15:32:26 +0200 |
|---|---|---|
| committer | cedricnjanga | 2017-10-03 16:33:49 +0200 |
| commit | 9ea95b98c52f99494a13befa54cfd8cd298ab0c4 (patch) | |
| tree | 11a795187148a63551b702fb2aecf502975eb9ef /app/controllers/concerns | |
| parent | 983f5953d6df7166e91f52ba5eccaf27b8841f76 (diff) | |
| download | chouette-core-9ea95b98c52f99494a13befa54cfd8cd298ab0c4.tar.bz2 | |
Refs #4665
Adapt date filters helpers according to this new concern
Try to correct build error : "ransack period range undefined"
All tests pass on my machine
Refs #4661
Remove string column from ComplianceCheckSet
Diffstat (limited to 'app/controllers/concerns')
| -rw-r--r-- | app/controllers/concerns/ransack_date_filter.rb | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/app/controllers/concerns/ransack_date_filter.rb b/app/controllers/concerns/ransack_date_filter.rb index 361c26c98..225fd91ee 100644 --- a/app/controllers/concerns/ransack_date_filter.rb +++ b/app/controllers/concerns/ransack_date_filter.rb @@ -4,23 +4,23 @@ module RansackDateFilter included do - def set_date_time_params + def set_date_time_params(param_name, klass) start_date = [] end_date = [] - if params[:q] && params[:q][@@date_param] && !params[:q][@@date_param].has_value?(nil) && !params[:q][@@date_param].has_value?("") + if params[:q] && params[:q][param_name] && !params[:q][param_name].has_value?(nil) && !params[:q][param_name].has_value?("") [1, 2, 3].each do |key| - start_date << params[:q][@@date_param]["start_date(#{key}i)"].to_i - end_date << params[:q][@@date_param]["end_date(#{key}i)"].to_i + start_date << params[:q][param_name]["start_date(#{key}i)"].to_i + end_date << params[:q][param_name]["end_date(#{key}i)"].to_i end - params[:q].delete([@@date_param]) + params[:q].delete([param_name]) - if @@klass == DateTime - @begin_range = @@klass.new(*start_date,0,0,0) rescue nil - @end_range = @@klass.new(*end_date,23,59,59) rescue nil + if klass == DateTime + @begin_range = klass.new(*start_date,0,0,0) rescue nil + @end_range = klass.new(*end_date,23,59,59) rescue nil else - @begin_range = @@klass.new(*start_date) rescue nil - @end_range = @@klass.new(*end_date) rescue nil + @begin_range = klass.new(*start_date) rescue nil + @end_range = klass.new(*end_date) rescue nil end end @@ -37,12 +37,5 @@ module RansackDateFilter end end - def self.set_date_param(param_name, klass) - @@date_param = param_name - @@klass = klass - end - - private_class_method :set_date_param - end end
\ No newline at end of file |
