Skip to content

Commit

Permalink
Some fixes to fancy format
Browse files Browse the repository at this point in the history
  • Loading branch information
Gesugao-san committed Jan 21, 2023
1 parent 3dad049 commit 2afe074
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions data/json/merged/_fancy.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "0000",
"name": "Space Station 13",
"parent": {
"id": ";___INSERT_ME_1___",
"name": "_root_;___REPLACE_ME_1___",
"id": "___INSERT_ME_1___",
"name": null,
"details": {
"type": "pin",
"note": "",
Expand All @@ -24,8 +24,8 @@
"id": "0001",
"name": "OpenSS13",
"parent": {
"id": ";___INSERT_ME_1___",
"name": "Space Station 13;___REPLACE_ME_1___",
"id": "___INSERT_ME_1___",
"name": "Space Station 13",
"details": {
"type": "parent",
"note": "",
Expand Down
11 changes: 7 additions & 4 deletions tools/legacy_to_d3_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ function convert(legacy_input) {
}}
]
let fancy_d3_format = [];
let tmp_fancy = [];
const legacy_keys = Object.keys(legacy_input);
for (let i = 0; i < legacy_keys.length; i++) {
const legacy_project_id = legacy_keys[i];
const legacy_project = legacy_input[legacy_project_id];
console.log(legacy_project_id, legacy_project);
fancy_d3_format.push(...[{
tmp_fancy = [{
"id": legacy_project_id,
"name": legacy_project.name,
"parent": {
"id": ";___INSERT_ME_1___",
"name": legacy_project.relations[0].name + ";___REPLACE_ME_1___",
"id": "___INSERT_ME_1___",
"name": legacy_project.relations[0].name, // + ";___REPLACE_ME_1___",
"details": {
"type": legacy_project.relations[0].type,
"note": legacy_project.relations[0].note,
Expand All @@ -126,7 +127,9 @@ function convert(legacy_input) {
"added_by": legacy_project.meta.added_by,
"add_date": legacy_project.meta.add_date
}
}]);
}];
if (legacy_project_id == "0000") tmp_fancy[0].parent.name = null;
fancy_d3_format.push(...tmp_fancy);
}
return fancy_d3_format;
}
Expand Down

0 comments on commit 2afe074

Please sign in to comment.