1
0

Fix new tasks not getting a new task index (#116)

This commit is contained in:
konrad
2019-12-08 15:10:34 +00:00
parent 720df3cbed
commit 7cdc997191
2 changed files with 99 additions and 59 deletions

View File

@ -497,6 +497,14 @@ func (t *Task) Create(a web.Auth) (err error) {
t.UID = utils.MakeRandomString(40)
}
// Get the index for this task
latestTask := &Task{}
_, err = x.Where("list_id = ?", t.ListID).OrderBy("id desc").Get(latestTask)
if err != nil {
return err
}
t.Index = latestTask.Index + 1
t.CreatedByID = u.ID
t.CreatedBy = u
if _, err = x.Insert(t); err != nil {