@@ -339,7 +339,12 class Query < ActiveRecord::Base | |||||
339 | when "t" |
|
339 | when "t" | |
340 | sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)] |
|
340 | sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)] | |
341 | when "w" |
|
341 | when "w" | |
342 | sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Time.now.at_beginning_of_week), connection.quoted_date(Time.now.next_week.yesterday)] |
|
342 | from = l(:general_first_day_of_week) == '7' ? | |
|
343 | # week starts on sunday | |||
|
344 | ((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) : | |||
|
345 | # week starts on monday (Rails default) | |||
|
346 | Time.now.at_beginning_of_week | |||
|
347 | sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)] | |||
343 | when "~" |
|
348 | when "~" | |
344 | sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'" |
|
349 | sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'" | |
345 | when "!~" |
|
350 | when "!~" |
General Comments 0
You need to be logged in to leave comments.
Login now