computeTaskListState

fun computeTaskListState(tasks: List<Task>, priority: Priority, nowMillis: Long): NodeState(source)

Returns the worst NodeState that should be displayed for a TaskList containing the given tasks under the given priority.

"Expired and open" is what drives escalation; an open task counts as expired when either:

  • it has a dueDate in the past (dueDate != null && dueDate <= now), or

  • the server scheduler already fired it (expiredExecuted == true) — the recurring case, where dueDate may be null because the next fire time was computed from the cron expression and never persisted.

Tier rules:

  • no expired-and-open tasks: NONE

  • priority is HIGH and any expired-and-open task: SEVERE

  • fixed-date overdue > 7 days: SEVERE

  • fixed-date overdue 1–7 days: WARN

  • otherwise (including recurring-only expiries without a dueDate): INFO

Returns early at SEVERE since no other tier can supersede it.