Change NOW() query to check for all-day tasks

Update query logic in FilterCriteriaProvider to use EOD time instead of current time for all-day tasks. Also, change the default start time for tasks to be non-time-specific (only relevant for when the filter being used to create a task is NOW).
pull/1545/head
Trevor Terris 3 years ago
parent bfacf1ca52
commit 4b522a7ce8

@ -111,7 +111,8 @@ class TaskCreator @Inject constructor(
when (key) {
Tag.KEY -> tags.add(value as String)
GoogleTask.KEY, CaldavTask.KEY, Place.KEY -> task.putTransitory(key, value)
DUE_DATE.name -> value.substitute()?.toLongOrNull()?.let { task.dueDate = it }
DUE_DATE.name -> value.substitute()?.toLongOrNull()?.let { task.dueDate =
createDueDate(Task.URGENCY_SPECIFIC_DAY, it) }
IMPORTANCE.name -> value.substitute()?.toIntOrNull()?.let { task.priority = it }
HIDE_UNTIL.name ->
value.substitute()?.toLongOrNull()?.let { task.hideUntil = it.startOfDay() }

@ -192,7 +192,13 @@ class FilterCriteriaProvider @Inject constructor(
and(
activeAndVisible(),
or(field("?").eq(0), Task.DUE_DATE.gt(0)),
Task.DUE_DATE.lte("?")))
// find tasks that have due dates before the specified
// date, or all-day tasks that have due dates before
// EOD today if the specified date is NOW
or(Task.DUE_DATE.lte("?"),
and(field("${Task.DUE_DATE} / 1000 % 60").eq(0),
field("?").eq(field("${PermaSql.VALUE_NOW}")),
Task.DUE_DATE.lte("${PermaSql.VALUE_EOD}")))))
.toString(),
values,
r.getStringArray(R.array.CFC_dueBefore_entries),

Loading…
Cancel
Save