Make sure to use kanban position in place of old position
This commit is contained in:
parent
c8d47e90cd
commit
4c48193819
@ -73,11 +73,11 @@ func validateTaskField(fieldName string) error {
|
||||
taskPropertyCreated,
|
||||
taskPropertyUpdated,
|
||||
taskPropertyPosition,
|
||||
taskPropertyKanbanPosition,
|
||||
taskPropertyBucketID:
|
||||
return nil
|
||||
}
|
||||
return ErrInvalidTaskField{TaskField: fieldName}
|
||||
|
||||
}
|
||||
|
||||
func getTaskFilterOptsFromCollection(tf *TaskCollection) (opts *taskOptions, err error) {
|
||||
|
@ -26,25 +26,26 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
taskPropertyID string = "id"
|
||||
taskPropertyTitle string = "title"
|
||||
taskPropertyDescription string = "description"
|
||||
taskPropertyDone string = "done"
|
||||
taskPropertyDoneAt string = "done_at"
|
||||
taskPropertyDueDate string = "due_date"
|
||||
taskPropertyCreatedByID string = "created_by_id"
|
||||
taskPropertyListID string = "list_id"
|
||||
taskPropertyRepeatAfter string = "repeat_after"
|
||||
taskPropertyPriority string = "priority"
|
||||
taskPropertyStartDate string = "start_date"
|
||||
taskPropertyEndDate string = "end_date"
|
||||
taskPropertyHexColor string = "hex_color"
|
||||
taskPropertyPercentDone string = "percent_done"
|
||||
taskPropertyUID string = "uid"
|
||||
taskPropertyCreated string = "created"
|
||||
taskPropertyUpdated string = "updated"
|
||||
taskPropertyPosition string = "position"
|
||||
taskPropertyBucketID string = "bucket_id"
|
||||
taskPropertyID string = "id"
|
||||
taskPropertyTitle string = "title"
|
||||
taskPropertyDescription string = "description"
|
||||
taskPropertyDone string = "done"
|
||||
taskPropertyDoneAt string = "done_at"
|
||||
taskPropertyDueDate string = "due_date"
|
||||
taskPropertyCreatedByID string = "created_by_id"
|
||||
taskPropertyListID string = "list_id"
|
||||
taskPropertyRepeatAfter string = "repeat_after"
|
||||
taskPropertyPriority string = "priority"
|
||||
taskPropertyStartDate string = "start_date"
|
||||
taskPropertyEndDate string = "end_date"
|
||||
taskPropertyHexColor string = "hex_color"
|
||||
taskPropertyPercentDone string = "percent_done"
|
||||
taskPropertyUID string = "uid"
|
||||
taskPropertyCreated string = "created"
|
||||
taskPropertyUpdated string = "updated"
|
||||
taskPropertyPosition string = "position"
|
||||
taskPropertyKanbanPosition string = "kanban_position"
|
||||
taskPropertyBucketID string = "bucket_id"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1010,6 +1010,7 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
|
||||
"bucket_id",
|
||||
"position",
|
||||
"repeat_mode",
|
||||
"kanban_position",
|
||||
}
|
||||
|
||||
// When a repeating task is marked as done, we update all deadlines and reminders and set it as undone
|
||||
@ -1116,6 +1117,9 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
|
||||
if t.Position == 0 {
|
||||
ot.Position = 0
|
||||
}
|
||||
if t.KanbanPosition == 0 {
|
||||
ot.KanbanPosition = 0
|
||||
}
|
||||
// Repeat from current date
|
||||
if t.RepeatMode == TaskRepeatModeDefault {
|
||||
ot.RepeatMode = TaskRepeatModeDefault
|
||||
|
@ -192,12 +192,12 @@ func TestTask_Update(t *testing.T) {
|
||||
defer s.Close()
|
||||
|
||||
task := &Task{
|
||||
ID: 4,
|
||||
Title: "test10000",
|
||||
Description: "Lorem Ipsum Dolor",
|
||||
Position: 10,
|
||||
ListID: 1,
|
||||
BucketID: 2, // Bucket 2 already has 3 tasks and a limit of 3
|
||||
ID: 4,
|
||||
Title: "test10000",
|
||||
Description: "Lorem Ipsum Dolor",
|
||||
KanbanPosition: 10,
|
||||
ListID: 1,
|
||||
BucketID: 2, // Bucket 2 already has 3 tasks and a limit of 3
|
||||
}
|
||||
err := task.Update(s, u)
|
||||
assert.NoError(t, err)
|
||||
|
@ -196,10 +196,10 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board) (fullVikunjaHierachi
|
||||
|
||||
// The usual stuff: Title, description, position, bucket id
|
||||
task := &models.Task{
|
||||
Title: card.Name,
|
||||
Description: card.Desc,
|
||||
Position: card.Pos,
|
||||
BucketID: bucketID,
|
||||
Title: card.Name,
|
||||
Description: card.Desc,
|
||||
KanbanPosition: card.Pos,
|
||||
BucketID: bucketID,
|
||||
}
|
||||
|
||||
if card.Due != nil {
|
||||
|
@ -209,11 +209,11 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
},
|
||||
Tasks: []*models.Task{
|
||||
{
|
||||
Title: "Test Card 1",
|
||||
Description: "Card Description",
|
||||
BucketID: 1,
|
||||
Position: 123,
|
||||
DueDate: time1,
|
||||
Title: "Test Card 1",
|
||||
Description: "Card Description",
|
||||
BucketID: 1,
|
||||
KanbanPosition: 123,
|
||||
DueDate: time1,
|
||||
Labels: []*models.Label{
|
||||
{
|
||||
Title: "Label 1",
|
||||
@ -248,18 +248,18 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
|
||||
* [ ] Pending Task
|
||||
* [ ] Another Pending Task`,
|
||||
BucketID: 1,
|
||||
Position: 124,
|
||||
BucketID: 1,
|
||||
KanbanPosition: 124,
|
||||
},
|
||||
{
|
||||
Title: "Test Card 3",
|
||||
BucketID: 1,
|
||||
Position: 126,
|
||||
Title: "Test Card 3",
|
||||
BucketID: 1,
|
||||
KanbanPosition: 126,
|
||||
},
|
||||
{
|
||||
Title: "Test Card 4",
|
||||
BucketID: 1,
|
||||
Position: 127,
|
||||
Title: "Test Card 4",
|
||||
BucketID: 1,
|
||||
KanbanPosition: 127,
|
||||
Labels: []*models.Label{
|
||||
{
|
||||
Title: "Label 2",
|
||||
@ -268,9 +268,9 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Title: "Test Card 5",
|
||||
BucketID: 2,
|
||||
Position: 111,
|
||||
Title: "Test Card 5",
|
||||
BucketID: 2,
|
||||
KanbanPosition: 111,
|
||||
Labels: []*models.Label{
|
||||
{
|
||||
Title: "Label 3",
|
||||
@ -279,20 +279,20 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Title: "Test Card 6",
|
||||
BucketID: 2,
|
||||
Position: 222,
|
||||
DueDate: time1,
|
||||
Title: "Test Card 6",
|
||||
BucketID: 2,
|
||||
KanbanPosition: 222,
|
||||
DueDate: time1,
|
||||
},
|
||||
{
|
||||
Title: "Test Card 7",
|
||||
BucketID: 2,
|
||||
Position: 333,
|
||||
Title: "Test Card 7",
|
||||
BucketID: 2,
|
||||
KanbanPosition: 333,
|
||||
},
|
||||
{
|
||||
Title: "Test Card 8",
|
||||
BucketID: 2,
|
||||
Position: 444,
|
||||
Title: "Test Card 8",
|
||||
BucketID: 2,
|
||||
KanbanPosition: 444,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -306,9 +306,9 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
},
|
||||
Tasks: []*models.Task{
|
||||
{
|
||||
Title: "Test Card 634",
|
||||
BucketID: 3,
|
||||
Position: 123,
|
||||
Title: "Test Card 634",
|
||||
BucketID: 3,
|
||||
KanbanPosition: 123,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -323,9 +323,9 @@ func TestConvertTrelloToVikunja(t *testing.T) {
|
||||
},
|
||||
Tasks: []*models.Task{
|
||||
{
|
||||
Title: "Test Card 63423",
|
||||
BucketID: 4,
|
||||
Position: 123,
|
||||
Title: "Test Card 63423",
|
||||
BucketID: 4,
|
||||
KanbanPosition: 123,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user