v0.3.0 修正:重复任务无日期自动补当天、通知高度自适应
This commit is contained in:
@@ -335,7 +335,20 @@ object Store {
|
||||
val today = Dates.todayStart()
|
||||
var changed = 0
|
||||
tasks(includeDone = false).forEach { t ->
|
||||
if (!t.repeating || t.due <= 0 || t.due >= today) return@forEach
|
||||
if (!t.repeating) return@forEach
|
||||
// 重复任务没设截止日时没有节奏可循,给它一个今天作为起点,
|
||||
// 否则它既不在「今日」里,也永远不会滚动
|
||||
if (t.due <= 0) {
|
||||
db.update(
|
||||
"tasks",
|
||||
ContentValues().apply { put("due", today) },
|
||||
"_id = ?",
|
||||
arrayOf(t.id.toString()),
|
||||
)
|
||||
changed++
|
||||
return@forEach
|
||||
}
|
||||
if (t.due >= today) return@forEach
|
||||
var due = t.due
|
||||
var guard = 0
|
||||
while (due < today && guard < 500) {
|
||||
|
||||
@@ -211,8 +211,10 @@ class TaskSheet(
|
||||
}
|
||||
val note = etNote.text.toString().trim()
|
||||
val every = if (repeatType == Repeat.NONE) 1 else repeatEvery.coerceAtLeast(1)
|
||||
// 重复任务必须有日期作为节奏起点,否则既进不了「今日」,也无法按间隔滚动
|
||||
val effectiveDue = if (repeatType != Repeat.NONE && due <= 0) Dates.todayStart() else due
|
||||
if (existing == null) {
|
||||
Store.addTask(title, note, projectId, priority, focusMin, due, repeatType, every)
|
||||
Store.addTask(title, note, projectId, priority, focusMin, effectiveDue, repeatType, every)
|
||||
} else {
|
||||
Store.updateTask(
|
||||
existing.copy(
|
||||
@@ -221,7 +223,7 @@ class TaskSheet(
|
||||
projectId = projectId,
|
||||
priority = priority,
|
||||
focusMinutes = focusMin,
|
||||
due = due,
|
||||
due = effectiveDue,
|
||||
repeatType = repeatType,
|
||||
repeatEvery = every,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user