1271 |
1271 |
sql = relative_date_clause(db_table, db_field, 1, 1, is_custom_filter)
|
1272 |
1272 |
when "w"
|
1273 |
1273 |
# = this week
|
1274 |
|
first_day_of_week = l(:general_first_day_of_week).to_i
|
|
1274 |
first_day_of_week = Redmine::Helpers::Calendar.first_wday
|
1275 |
1275 |
day_of_week = User.current.today.cwday
|
1276 |
1276 |
days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)
|
1277 |
1277 |
sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6, is_custom_filter)
|
1278 |
1278 |
when "lw"
|
1279 |
1279 |
# = last week
|
1280 |
|
first_day_of_week = l(:general_first_day_of_week).to_i
|
|
1280 |
first_day_of_week = Redmine::Helpers::Calendar.first_wday
|
1281 |
1281 |
day_of_week = User.current.today.cwday
|
1282 |
1282 |
days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)
|
1283 |
1283 |
sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1, is_custom_filter)
|
1284 |
1284 |
when "l2w"
|
1285 |
1285 |
# = last 2 weeks
|
1286 |
|
first_day_of_week = l(:general_first_day_of_week).to_i
|
|
1286 |
first_day_of_week = Redmine::Helpers::Calendar.first_wday
|
1287 |
1287 |
day_of_week = User.current.today.cwday
|
1288 |
1288 |
days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)
|
1289 |
1289 |
sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1, is_custom_filter)
|
1290 |
1290 |
when "nw"
|
1291 |
1291 |
# = next week
|
1292 |
|
first_day_of_week = l(:general_first_day_of_week).to_i
|
|
1292 |
first_day_of_week = Redmine::Helpers::Calendar.first_wday
|
1293 |
1293 |
day_of_week = User.current.today.cwday
|
1294 |
1294 |
from = -(day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week) + 7
|
1295 |
1295 |
sql = relative_date_clause(db_table, db_field, from, from + 6, is_custom_filter)
|