chore: cleanup
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Vikunja is a to-do project application to facilitate your life.
|
||||
// Vikunja is a to-do list application to facilitate your life.
|
||||
// Copyright 2018-2021 Vikunja and contributors. All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -1210,7 +1210,7 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
|
||||
|
||||
// Update all positions if the newly saved position is < 0.1
|
||||
if ot.Position < 0.1 {
|
||||
err = recalculateTaskPositions(s, t.ListID)
|
||||
err = recalculateTaskPositions(s, t.ProjectID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1273,11 +1273,11 @@ func recalculateTaskKanbanPositions(s *xorm.Session, bucketID int64) (err error)
|
||||
return
|
||||
}
|
||||
|
||||
func recalculateTaskPositions(s *xorm.Session, listID int64) (err error) {
|
||||
func recalculateTaskPositions(s *xorm.Session, projectID int64) (err error) {
|
||||
|
||||
allTasks := []*Task{}
|
||||
err = s.
|
||||
Where("list_id = ?", listID).
|
||||
Where("project_id = ?", projectID).
|
||||
OrderBy("position asc").
|
||||
Find(&allTasks)
|
||||
if err != nil {
|
||||
|
@ -380,7 +380,7 @@ func TestTask_Update(t *testing.T) {
|
||||
time.Unix(1674745156, 0),
|
||||
time.Unix(1674745156, 223),
|
||||
},
|
||||
ListID: 1,
|
||||
ProjectID: 1,
|
||||
}
|
||||
err := task.Update(s, u)
|
||||
assert.NoError(t, err)
|
||||
|
Reference in New Issue
Block a user