class Babik::Selection::Operation::Week
ISO Week
of year (1-52/53) from date operation
Public Instance Methods
sql_function()
click to toggle source
# File lib/babik/queryset/lib/selection/operation/date.rb, line 120 def sql_function dbms_adapter = db_engine return 'WEEK(#field, 3)' if dbms_adapter == 'mysql2' return 'EXTRACT(WEEK FROM #field)' if dbms_adapter == 'postgresql' return '(strftime(\'%j\', date(#field, \'-3 days\', \'weekday 4\')) - 1) / 7 + 1' if dbms_adapter == 'sqlite3' raise NotImplementedError, "#{self.class} lookup not implemented for #{dbms_adapter}" end