Release 1.3.2 (#170)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 9s
Renovate / renovate (push) Successful in 2m0s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Successful in 18m41s
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Successful in 1m7s
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 9s
Renovate / renovate (push) Successful in 2m0s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Successful in 18m41s
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Successful in 1m7s
Bumps to 1.3.2 (1030299), dates the changelog and adds the What's New for all eight store locales. - Keep home and task list clear of the navigation bar (#152, #165) - Keep the edited description line above the keyboard (#158, #163) - Drop reminders when a task loses its last date (#159, #161) - Show when a list uses its own default reminders (#121, #168) - Setting for the description shown in reminders (#156, #162) - Raise SEQUENCE when uploading an edited task (#137, #169) PR 169 had no CHANGELOG entry for #137, so this adds it. Closes #121, closes #137, closes #152, closes #156, closes #158, closes #159 Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de> Reviewed-on: https://codeberg.org/jlmakiola/agendula/pulls/170
This commit is contained in:
1 parent
3e34c60577
commit
1463b08d6f
53 files changed
+3419
-143
No files matched your search
+175
@@ -14,6 +14,7 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Duration.Companion.days
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Instant
|
||||
|
||||
/**
|
||||
@@ -700,6 +701,180 @@ class RoomTasksDataSourceTest {
|
||||
assertThat(db.tasks().overrides(id)).hasSize(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movingARoutineOnReopensItsCompletedSubtasks() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val done = source.insertTask(form(title = "Step").copy(parentId = id))
|
||||
val nested = source.insertTask(form(title = "Nested").copy(parentId = done))
|
||||
val cancelled = source.insertTask(form(title = "Skipped").copy(parentId = id))
|
||||
val daily = source.insertTask(form(title = "Daily part").copy(parentId = id))
|
||||
makeRecurring(daily, at, rule = "FREQ=DAILY")
|
||||
source.setCompleted(done, completed = true)
|
||||
source.setCompleted(nested, completed = true)
|
||||
source.setCancelled(cancelled, cancelled = true)
|
||||
source.setCompletedInstance(daily, at, completed = true)
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(id)!!.dtstart).isEqualTo(at + 7.days)
|
||||
assertThat(db.tasks().entity(done)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(done)!!.completedAt).isNull()
|
||||
assertThat(db.tasks().entity(nested)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(cancelled)!!.status).isEqualTo(TaskStatus.CANCELLED)
|
||||
// A recurring subtask has its own series, and its closed occurrence stays closed.
|
||||
assertThat(db.tasks().overrides(daily).single().status).isEqualTo(TaskStatus.COMPLETED)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aHalfDoneSubtaskStartsOverToo() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val step = source.insertTask(form(title = "Step", percentComplete = 40).copy(parentId = id))
|
||||
db.tasks().update(db.tasks().entity(step)!!.copy(status = TaskStatus.IN_PROCESS, percentComplete = 40))
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(step)!!.percentComplete).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movingARoutineBackRestoresTheSubtasksItReset() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val done = source.insertTask(form(title = "Step").copy(parentId = id))
|
||||
val touched = source.insertTask(form(title = "Touched since").copy(parentId = id))
|
||||
source.setCompleted(done, completed = true)
|
||||
source.setCompleted(touched, completed = true)
|
||||
val completedAt = db.tasks().entity(done)!!.completedAt
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
db.tasks().update(db.tasks().entity(touched)!!.copy(percentComplete = 30))
|
||||
|
||||
source.setCompletedInstance(id, at, completed = false)
|
||||
|
||||
assertThat(db.tasks().entity(id)!!.dtstart).isEqualTo(at)
|
||||
assertThat(db.tasks().entity(done)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
assertThat(db.tasks().entity(done)!!.completedAt).isEqualTo(completedAt)
|
||||
// Changed after the reset: the user's state wins.
|
||||
assertThat(db.tasks().entity(touched)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(touched)!!.percentComplete).isEqualTo(30)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aDatedSubtaskMovesWithItsRoutineAndBack() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val step = source.insertTask(form(title = "Step", due = at + 1.days).copy(parentId = id))
|
||||
val undated = source.insertTask(form(title = "Undated").copy(parentId = id))
|
||||
source.setCompleted(step, completed = true)
|
||||
val due = db.tasks().entity(step)!!.due!!
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
// A week of wall-clock time: an hour either way across a DST change.
|
||||
assertThat(db.tasks().entity(step)!!.due!! - due).isIn(com.google.common.collect.Range.closed(7.days - 1.hours, 7.days + 1.hours))
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(undated)!!.due).isNull()
|
||||
|
||||
source.setCompletedInstance(id, at, completed = false)
|
||||
|
||||
assertThat(db.tasks().entity(step)!!.due).isEqualTo(due)
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMarkedCopyUnderARoutineIsLeftAlone() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val routineUid = db.tasks().entity(id)!!.uid
|
||||
val copy = source.insertTask(form(title = "Daily part").copy(parentId = id))
|
||||
val elsewhere = source.insertTask(form(title = "Moved here").copy(parentId = id))
|
||||
source.setCompleted(copy, completed = true)
|
||||
source.setCompleted(elsewhere, completed = true)
|
||||
db.tasks().update(db.tasks().entity(copy)!!.copy(unknownProperties = "X-AGENDULA-TICK-COPY:$routineUid"))
|
||||
db.tasks().update(db.tasks().entity(elsewhere)!!.copy(unknownProperties = "X-AGENDULA-TICK-COPY:another-parent"))
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(copy)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
// Its marker names a parent it no longer sits under: an ordinary sub-task here.
|
||||
assertThat(db.tasks().entity(elsewhere)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSubtaskInAnotherListStartsOverAndComesBack() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val otherList = source.createLocalList("Errands", 0)
|
||||
val step = source.insertTask(form(title = "Elsewhere", due = at + 1.days).copy(listId = otherList, parentId = id))
|
||||
source.setCompleted(step, completed = true)
|
||||
val due = db.tasks().entity(step)!!.due
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(step)!!.listId).isEqualTo(otherList)
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.NEEDS_ACTION)
|
||||
assertThat(db.tasks().entity(step)!!.due).isNotEqualTo(due)
|
||||
|
||||
source.setCompletedInstance(id, at, completed = false)
|
||||
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
assertThat(db.tasks().entity(step)!!.due).isEqualTo(due)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSubtaskCompletedBeforeTheClosedCycleIsLeftAlone() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val old = source.insertTask(form(title = "Old copy", due = at - 30.days).copy(parentId = id))
|
||||
source.setCompleted(old, completed = true)
|
||||
db.tasks().update(db.tasks().entity(old)!!.copy(completedAt = at - 30.days))
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(old)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
assertThat(db.tasks().entity(old)!!.due).isEqualTo(at - 30.days)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRestoredSubtaskTickedSinceKeepsItsStateAndGetsItsDateBack() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Routine"))
|
||||
makeRecurring(id, at)
|
||||
val step = source.insertTask(form(title = "Step", due = at + 1.days).copy(parentId = id))
|
||||
source.setCompleted(step, completed = true)
|
||||
val due = db.tasks().entity(step)!!.due
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
source.setCompleted(step, completed = true)
|
||||
|
||||
source.setCompletedInstance(id, at, completed = false)
|
||||
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
assertThat(db.tasks().entity(step)!!.due).isEqualTo(due)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRoutineTickedOnItsLastOccurrenceLeavesItsSubtasksDone() {
|
||||
val at = now
|
||||
val id = source.insertTask(form(title = "Once more"))
|
||||
makeRecurring(id, at, rule = "FREQ=WEEKLY;COUNT=1")
|
||||
val step = source.insertTask(form(title = "Step").copy(parentId = id))
|
||||
source.setCompleted(step, completed = true)
|
||||
|
||||
source.setCompletedInstance(id, at, completed = true)
|
||||
|
||||
assertThat(db.tasks().entity(id)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
assertThat(db.tasks().entity(step)!!.status).isEqualTo(TaskStatus.COMPLETED)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSeriesReshapedSinceIsNotMovedBack() {
|
||||
val at = now
|
||||
|
||||
+19
@@ -174,6 +174,25 @@ class TasksDatabaseMigrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addsAnEmptyResetSubtasksRecord() {
|
||||
helper.createDatabase(TEST_DB, 5).use { db ->
|
||||
db.execSQL("INSERT INTO task_lists (id, name, color) VALUES (1, 'Personal', 0)")
|
||||
db.execSQL("INSERT INTO tasks (id, list_id, uid) VALUES (1, 1, 'a'), (2, 1, 'b')")
|
||||
db.execSQL(
|
||||
"INSERT INTO advanced_occurrences (copy_id, master_id, anchor, advanced_to, prior_status, spent, from_override) " +
|
||||
"VALUES (2, 1, 0, 1, 0, 1, 0)",
|
||||
)
|
||||
}
|
||||
|
||||
helper.runMigrationsAndValidate(TEST_DB, 6, true, TasksDatabase.MIGRATION_5_6).use { db ->
|
||||
db.query("SELECT reset_subtasks FROM advanced_occurrences").use { c ->
|
||||
assertThat(c.moveToFirst()).isTrue()
|
||||
assertThat(c.getString(0)).isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TEST_DB = "migration-test.db"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user