lib/rails_powergrid/smart_date/smart_date.rb
# Return the sql to filter for this period.
Return the sql to filter for this period.
Return the sql to filter for this period .
def operation field, operator, start_date, end_date
      case operator
      when "="
        "#{field} >= #{start_date} AND #{field} < #{end_date}"
      when "<>"
        "#{field} < #{start_date} OR #{field} >= #{end_date}"
      when ">"
        "#{field} >= #{end_date}"
      when "<"
        "#{field} < #{start_date}"
      when ">="
        "#{field} >= #{start_date}"
      when "<="
        "#{field} < #{end_date}"
      else
        "#{field} #{operator} #{start_date}" 
      end
    end
def operation field , operator , start_date , end_date case operator when "=" "#{field} >= #{start_date} AND #{field} < #{end_date}" when "<>" "#{field} < #{start_date} OR #{field} >= #{end_date}" when ">" "#{field} >= #{end_date}" when "<" "#{field} < #{start_date}" when ">=" "#{field} >= #{start_date}" when "<=" "#{field} < #{end_date}" else "#{field} #{operator} #{start_date}" end end
Return the sql to filter for this period.
Return the sql to filter for this period .
#Fallback
field
<not_specific>
operator
<not_specific>
start_date
<not_specific>
end_date
<not_specific>