fix(docs): explain why we use NoAutoTime().

Add a comment explaining why we use NoAutoTime() when synchronizing
the positions of tasks in a bucket/project.
This commit is contained in:
Erwan Martin 2023-09-17 18:42:16 +02:00
parent 4f55099896
commit 49a790fdad
1 changed files with 8 additions and 0 deletions

View File

@ -1081,6 +1081,10 @@ func recalculateTaskKanbanPositions(s *xorm.Session, bucketID int64) (err error)
currentPosition := maxPosition / float64(len(allTasks)) * (float64(i + 1))
// Here we use "NoAutoTime() to prevent the ORM from updating column "updated" automatically.
// Otherwise, this signals to CalDAV clients that the task has changed, which is not the case.
// Consequence: when synchronizing a list of tasks, the first one immediately changes the date of all the
// following ones from the same batch, which are then unable to be updated.
_, err = s.Cols("kanban_position").
Where("id = ?", task.ID).
NoAutoTime().
@ -1110,6 +1114,10 @@ func recalculateTaskPositions(s *xorm.Session, projectID int64) (err error) {
currentPosition := maxPosition / float64(len(allTasks)) * (float64(i + 1))
// Here we use "NoAutoTime() to prevent the ORM from updating column "updated" automatically.
// Otherwise, this signals to CalDAV clients that the task has changed, which is not the case.
// Consequence: when synchronizing a list of tasks, the first one immediately changes the date of all the
// following ones from the same batch, which are then unable to be updated.
_, err = s.Cols("position").
Where("id = ?", task.ID).
NoAutoTime().