Add task identifier #115

Merged
konrad merged 15 commits from feature/task-identifier into master 2019-12-07 22:28:47 +00:00
5 changed files with 120 additions and 4 deletions
Showing only changes of commit e1f85d83ea - Show all commits

View File

@ -2,7 +2,7 @@
id: 1
title: Test1
description: Lorem Ipsum
identifier: test
identifier: test1
owner_id: 1
namespace_id: 1
updated: 0
@ -11,6 +11,7 @@
id: 2
title: Test2
description: Lorem Ipsum
identifier: test2
owner_id: 3
namespace_id: 1
updated: 0
@ -19,6 +20,7 @@
id: 3
title: Test3
description: Lorem Ipsum
identifier: test3
owner_id: 3
namespace_id: 2
updated: 0
@ -27,6 +29,7 @@
id: 4
title: Test4
description: Lorem Ipsum
identifier: test4
owner_id: 3
namespace_id: 3
updated: 0
@ -35,6 +38,7 @@
id: 5
title: Test5
description: Lorem Ipsum
identifier: test5
owner_id: 5
namespace_id: 5
updated: 0
@ -43,6 +47,7 @@
id: 6
title: Test6
description: Lorem Ipsum
identifier: test6
owner_id: 6
namespace_id: 6
updated: 0
@ -51,6 +56,7 @@
id: 7
title: Test7
description: Lorem Ipsum
identifier: test7
owner_id: 6
namespace_id: 6
updated: 0
@ -59,6 +65,7 @@
id: 8
title: Test8
description: Lorem Ipsum
identifier: test8
owner_id: 6
namespace_id: 6
updated: 0
@ -67,6 +74,7 @@
id: 9
title: Test9
description: Lorem Ipsum
identifier: test9
owner_id: 6
namespace_id: 6
updated: 0
@ -75,6 +83,7 @@
id: 10
title: Test10
description: Lorem Ipsum
identifier: test10
owner_id: 6
namespace_id: 6
updated: 0
@ -83,6 +92,7 @@
id: 11
title: Test11
description: Lorem Ipsum
identifier: test11
owner_id: 6
namespace_id: 6
updated: 0
@ -91,6 +101,7 @@
id: 12
title: Test12
description: Lorem Ipsum
identifier: test12
owner_id: 6
namespace_id: 7
updated: 0
@ -99,6 +110,7 @@
id: 13
title: Test13
description: Lorem Ipsum
identifier: test13
owner_id: 6
namespace_id: 8
updated: 0
@ -107,6 +119,7 @@
id: 14
title: Test14
description: Lorem Ipsum
identifier: test14
owner_id: 6
namespace_id: 9
updated: 0
@ -115,6 +128,7 @@
id: 15
title: Test15
description: Lorem Ipsum
identifier: test15
owner_id: 6
namespace_id: 10
updated: 0
@ -123,6 +137,7 @@
id: 16
title: Test16
description: Lorem Ipsum
identifier: test16
owner_id: 6
namespace_id: 11
updated: 0
@ -131,6 +146,7 @@
id: 17
title: Test17
description: Lorem Ipsum
identifier: test17
owner_id: 6
namespace_id: 12
updated: 0
@ -141,6 +157,7 @@
id: 18
title: Test18
description: Lorem Ipsum
identifier: test18
owner_id: 7
namespace_id: 13
updated: 0
@ -149,6 +166,7 @@
id: 19
title: Test19
description: Lorem Ipsum
identifier: test19
owner_id: 7
namespace_id: 14
updated: 0
@ -157,6 +175,7 @@
id: 20
title: Test20
description: Lorem Ipsum
identifier: test20
owner_id: 13
namespace_id: 15
updated: 0

View File

@ -3,6 +3,7 @@
description: 'Lorem Ipsum'
created_by_id: 1
list_id: 1
index: 1
created: 1543626724
updated: 1543626724
- id: 2
@ -10,12 +11,14 @@
done: true
created_by_id: 1
list_id: 1
index: 2
created: 1543626724
updated: 1543626724
- id: 3
text: 'task #3 high prio'
created_by_id: 1
list_id: 1
index: 3
created: 1543626724
updated: 1543626724
priority: 100
@ -23,6 +26,7 @@
text: 'task #4 low prio'
created_by_id: 1
list_id: 1
index: 4
created: 1543626724
updated: 1543626724
priority: 1
@ -30,6 +34,7 @@
text: 'task #5 higher due date'
created_by_id: 1
list_id: 1
index: 5
created: 1543626724
updated: 1543626724
due_date_unix: 1543636724
@ -37,6 +42,7 @@
text: 'task #6 lower due date'
created_by_id: 1
list_id: 1
index: 6
created: 1543626724
updated: 1543626724
due_date_unix: 1543616724
@ -44,6 +50,7 @@
text: 'task #7 with start date'
created_by_id: 1
list_id: 1
index: 7
created: 1543626724
updated: 1543626724
start_date_unix: 1544600000
@ -51,6 +58,7 @@
text: 'task #8 with end date'
created_by_id: 1
list_id: 1
index: 8
created: 1543626724
updated: 1543626724
end_date_unix: 1544700000
@ -58,6 +66,7 @@
text: 'task #9 with start and end date'
created_by_id: 1
list_id: 1
index: 9
created: 1543626724
updated: 1543626724
start_date_unix: 1544600000
@ -66,108 +75,126 @@
text: 'task #10 basic'
created_by_id: 1
list_id: 1
index: 10
created: 1543626724
updated: 1543626724
- id: 11
text: 'task #11 basic'
created_by_id: 1
list_id: 1
index: 11
created: 1543626724
updated: 1543626724
- id: 12
text: 'task #12 basic'
created_by_id: 1
list_id: 1
index: 12
created: 1543626724
updated: 1543626724
- id: 13
text: 'task #13 basic other list'
created_by_id: 1
list_id: 2
index: 1
created: 1543626724
updated: 1543626724
- id: 14
text: 'task #14 basic other list'
created_by_id: 5
list_id: 5
index: 1
created: 1543626724
updated: 1543626724
- id: 15
text: 'task #15'
created_by_id: 6
list_id: 6
index: 1
created: 1543626724
updated: 1543626724
- id: 16
text: 'task #16'
created_by_id: 6
list_id: 7
index: 1
created: 1543626724
updated: 1543626724
- id: 17
text: 'task #17'
created_by_id: 6
list_id: 8
index: 1
created: 1543626724
updated: 1543626724
- id: 18
text: 'task #18'
created_by_id: 6
list_id: 9
index: 1
created: 1543626724
updated: 1543626724
- id: 19
text: 'task #19'
created_by_id: 6
list_id: 10
index: 1
created: 1543626724
updated: 1543626724
- id: 20
text: 'task #20'
created_by_id: 6
list_id: 11
index: 1
created: 1543626724
updated: 1543626724
- id: 21
text: 'task #21'
created_by_id: 6
list_id: 12
index: 1
created: 1543626724
updated: 1543626724
- id: 22
text: 'task #22'
created_by_id: 6
list_id: 13
index: 1
created: 1543626724
updated: 1543626724
- id: 23
text: 'task #23'
created_by_id: 6
list_id: 14
index: 1
created: 1543626724
updated: 1543626724
- id: 24
text: 'task #24'
created_by_id: 6
list_id: 15
index: 1
created: 1543626724
updated: 1543626724
- id: 25
text: 'task #25'
created_by_id: 6
list_id: 16
index: 1
created: 1543626724
updated: 1543626724
- id: 26
text: 'task #26'
created_by_id: 6
list_id: 17
index: 1
created: 1543626724
updated: 1543626724
- id: 27
text: 'task #27 with reminders'
created_by_id: 1
list_id: 1
index: 12
created: 1543626724
updated: 1543626724
- id: 28
@ -176,24 +203,28 @@
created_by_id: 1
repeat_after: 3600
list_id: 1
index: 13
created: 1543626724
updated: 1543626724
- id: 29
text: 'task #29 with parent task (1)'
created_by_id: 1
list_id: 1
index: 14
created: 1543626724
updated: 1543626724
- id: 30
text: 'task #30 with assignees'
created_by_id: 1
list_id: 1
index: 15
created: 1543626724
updated: 1543626724
- id: 31
text: 'task #31 with color'
created_by_id: 1
list_id: 1
index: 16
hex_color: f0f0f0
created: 1543626724
updated: 1543626724
@ -201,12 +232,14 @@
text: 'task #32'
created_by_id: 1
list_id: 3
index: 1
created: 1543626724
updated: 1543626724
- id: 33
text: 'task #33 with percent done'
created_by_id: 1
list_id: 1
index: 17
percent_done: 0.5
created: 1543626724
updated: 1543626724

View File

@ -69,7 +69,7 @@ func TestList_CreateOrUpdate(t *testing.T) {
list := List{
Title: "test",
Description: "Lorem Ipsum",
Identifier: "test",
Identifier: "test1",
NamespaceID: 1,
}
@ -109,7 +109,7 @@ func TestList_CreateOrUpdate(t *testing.T) {
list := List{
Title: "test",
Description: "Lorem Ipsum",
Identifier: "test",
Identifier: "test1",
NamespaceID: 1,
}

View File

@ -55,6 +55,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
ID: 1,
Text: "task #1",
Description: "Lorem Ipsum",
Identifier: "test1-1",
Index: 1,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -73,6 +75,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
{
ID: 29,
Text: "task #29 with parent task (1)",
Index: 14,
CreatedByID: 1,
ListID: 1,
Created: 1543626724,
@ -109,6 +112,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task2 := &Task{
ID: 2,
Text: "task #2 done",
Identifier: "test1-2",
Index: 2,
Done: true,
CreatedByID: 1,
CreatedBy: user1,
@ -130,6 +135,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task3 := &Task{
ID: 3,
Text: "task #3 high prio",
Identifier: "test1-3",
Index: 3,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -141,6 +148,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task4 := &Task{
ID: 4,
Text: "task #4 low prio",
Identifier: "test1-4",
Index: 4,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -152,6 +161,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task5 := &Task{
ID: 5,
Text: "task #5 higher due date",
Identifier: "test1-5",
Index: 5,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -163,6 +174,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task6 := &Task{
ID: 6,
Text: "task #6 lower due date",
Identifier: "test1-6",
Index: 6,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -174,6 +187,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task7 := &Task{
ID: 7,
Text: "task #7 with start date",
Identifier: "test1-7",
Index: 7,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -185,6 +200,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task8 := &Task{
ID: 8,
Text: "task #8 with end date",
Identifier: "test1-8",
Index: 8,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -196,6 +213,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task9 := &Task{
ID: 9,
Text: "task #9 with start and end date",
Identifier: "test1-9",
Index: 9,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -208,6 +227,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task10 := &Task{
ID: 10,
Text: "task #10 basic",
Identifier: "test1-10",
Index: 10,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -218,6 +239,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task11 := &Task{
ID: 11,
Text: "task #11 basic",
Identifier: "test1-11",
Index: 11,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -228,6 +251,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task12 := &Task{
ID: 12,
Text: "task #12 basic",
Identifier: "test1-12",
Index: 12,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -238,6 +263,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task15 := &Task{
ID: 15,
Text: "task #15",
Identifier: "test6-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 6,
@ -248,6 +275,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task16 := &Task{
ID: 16,
Text: "task #16",
Identifier: "test7-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 7,
@ -258,6 +287,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task17 := &Task{
ID: 17,
Text: "task #17",
Identifier: "test8-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 8,
@ -268,6 +299,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task18 := &Task{
ID: 18,
Text: "task #18",
Identifier: "test9-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 9,
@ -278,6 +311,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task19 := &Task{
ID: 19,
Text: "task #19",
Identifier: "test10-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 10,
@ -288,6 +323,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task20 := &Task{
ID: 20,
Text: "task #20",
Identifier: "test11-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 11,
@ -298,6 +335,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task21 := &Task{
ID: 21,
Text: "task #21",
Identifier: "test12-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 12,
@ -308,6 +347,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task22 := &Task{
ID: 22,
Text: "task #22",
Identifier: "test13-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 13,
@ -318,6 +359,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task23 := &Task{
ID: 23,
Text: "task #23",
Identifier: "test14-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 14,
@ -328,6 +371,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task24 := &Task{
ID: 24,
Text: "task #24",
Identifier: "test15-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 15,
@ -338,6 +383,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task25 := &Task{
ID: 25,
Text: "task #25",
Identifier: "test16-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 16,
@ -348,6 +395,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task26 := &Task{
ID: 26,
Text: "task #26",
Identifier: "test17-1",
Index: 1,
CreatedByID: 6,
CreatedBy: user6,
ListID: 17,
@ -358,6 +407,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task27 := &Task{
ID: 27,
Text: "task #27 with reminders",
Identifier: "test1-12",
Index: 12,
CreatedByID: 1,
CreatedBy: user1,
RemindersUnix: []int64{1543626724, 1543626824},
@ -369,6 +420,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task28 := &Task{
ID: 28,
Text: "task #28 with repeat after",
Identifier: "test1-13",
Index: 13,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -380,6 +433,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task29 := &Task{
ID: 29,
Text: "task #29 with parent task (1)",
Identifier: "test1-14",
Index: 14,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -389,6 +444,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
ID: 1,
Text: "task #1",
Description: "Lorem Ipsum",
Index: 1,
CreatedByID: 1,
ListID: 1,
Created: 1543626724,
@ -402,6 +458,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task30 := &Task{
ID: 30,
Text: "task #30 with assignees",
Identifier: "test1-15",
Index: 15,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,
@ -416,6 +474,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task31 := &Task{
ID: 31,
Text: "task #31 with color",
Identifier: "test1-16",
Index: 16,
HexColor: "f0f0f0",
CreatedByID: 1,
CreatedBy: user1,
@ -427,6 +487,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task32 := &Task{
ID: 32,
Text: "task #32",
Identifier: "test3-1",
Index: 1,
CreatedByID: 1,
CreatedBy: user1,
ListID: 3,
@ -437,6 +499,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task33 := &Task{
ID: 33,
Text: "task #33 with percent done",
Identifier: "test1-17",
Index: 17,
CreatedByID: 1,
CreatedBy: user1,
ListID: 1,

View File

@ -414,7 +414,7 @@ func addMoreInfoToTasks(taskMap map[int64]*Task) (tasks []*Task, err error) {
task.RelatedTasks = make(RelatedTaskMap)
// Build the task identifier from the list identifier and task index
task.Identifier = lists[task.ListID].Identifier + strconv.FormatInt(task.Index, 10)
task.Identifier = lists[task.ListID].Identifier + "-" + strconv.FormatInt(task.Index, 10)
}
// Get all related tasks