fix(migration): import TickTick data by column name instead of index #1356

Merged
konrad merged 5 commits from kooshi/api:main into main 2023-01-24 13:58:21 +00:00
Contributor

A new column "Kind" was inserted to index 3 in the csv.

Also, handling of parent tasks was incorrect (parent id and task id were both reading from index 21)

A new column "Kind" was inserted to index 3 in the csv. Also, handling of parent tasks was incorrect (parent id and task id were both reading from index 21)
kooshi added 1 commit 2023-01-06 02:43:56 +00:00
konrad reviewed 2023-01-06 09:38:12 +00:00
@ -213,2 +212,3 @@
parentID, err := strconv.ParseInt(record[23], 10, 64)
if err != nil {
return err
parentID = 0
Owner

Isn't the parentID already 0 if there's an error?

If we're ignoring the error anyway we might as well just remove the if and do something like parentID, _ := strconv.ParseInt(record[23], 10, 64).

Isn't the `parentID` already `0` if there's an error? If we're ignoring the error anyway we might as well just remove the if and do something like `parentID, _ := strconv.ParseInt(record[23], 10, 64)`.
Owner

I think the tests only check if the conversion from TickTick's structure to Vikunja's works, not if the csv is correctly parsed. Do you want to add tests for that?

I think the tests only check if the conversion from TickTick's structure to Vikunja's works, not if the csv is correctly parsed. Do you want to add tests for that?
Owner

It's probably a good idea to switch the csv parsing to something like https://github.com/gocarina/gocsv so that we can avoid issues like this where they shuffle columns or add new ones in between in the future. (not in this PR though)

It's probably a good idea to switch the csv parsing to something like https://github.com/gocarina/gocsv so that we can avoid issues like this where they shuffle columns or add new ones in between in the future. (not in this PR though)
Owner

Any update here?

Any update here?
Owner
Resolves this issue: https://github.com/go-vikunja/api/issues/61
konrad added 1 commit 2023-01-23 18:13:22 +00:00
konrad added 1 commit 2023-01-23 18:15:04 +00:00
continuous-integration/drone/pr Build is failing Details
37240caad4
fix: lint
konrad changed title from fix ticktick migration, still need to update test to match to fix(migration): import TickTick data by column name instead of index 2023-01-23 18:15:50 +00:00
Owner

Now updated to pull the data by name from the csv file instead of relying on column indexes.

Now updated to pull the data by name from the csv file instead of relying on column indexes.
konrad scheduled this pull request to auto merge when all checks succeed 2023-01-23 18:17:58 +00:00
Owner

Thanks for your effort!

Thanks for your effort!
konrad added 1 commit 2023-01-24 13:22:11 +00:00
continuous-integration/drone/pr Build is failing Details
14d8e2d586
fix: lint
konrad added 1 commit 2023-01-24 13:51:00 +00:00
continuous-integration/drone/pr Build is passing Details
4f05061cc3
fix: lint
konrad merged commit 31a1452839 into main 2023-01-24 13:58:21 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#1356
No description provided.