conversion script ready

master
Philippe PITTOLI 4 years ago
parent a8dbeb006b
commit 95ca14e6b8

@ -50,7 +50,16 @@ old_storage.each do |old_project|
# 3.1. get list properties
extra_properties = Hash(String, JSON::Any).new
extra_properties["columns"] = JSON.parse(old_project.columns.to_json)
# columns = JSON.parse(old_project.columns.to_json)
columns = Array(Hash(String, String)).new
old_project.columns.each do |col|
column = { "id" => col.id, "title" => col.name }
columns << column
puts "column :"
pp! column
end
extra_properties["columns"] = JSON.parse(columns.to_json)
# 3.2. get tasks, create new tasks and store them
@ -63,9 +72,15 @@ old_storage.each do |old_project|
# 2. create a task in the new format
task_extra_properties = Hash(String, JSON::Any).new
task_extra_properties["column"] = JSON.parse(t.column.to_json)
task_extra_properties["backgroundColor"] = JSON.parse(t.color.to_json)
task_extra_properties["assigneeId"] = JSON.parse(t.assigned_to.to_json)
task_extra_properties["column"] = JSON.parse(t.column.to_json)
# change the default color of the task, to match the new default list background color
if t.color == "dark"
task_extra_properties["backgroundColor"] = JSON.parse("white".to_json)
else
task_extra_properties["backgroundColor"] = JSON.parse(t.color.to_json)
end
task_extra_properties["assigneeId"] = JSON.parse(t.assigned_to.to_json)
newtask = ::TodoD::Task.new old_project.id, t.title, t.author,
description: (t.description || ""),
@ -83,6 +98,7 @@ old_storage.each do |old_project|
u = User.new
list = TodoD::List.new old_project.name, u, extra_properties
list.id = old_project.id
list.tasks = tasks.map &.id
# puts ""

Loading…
Cancel
Save