Even more fancier merger output

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-03-07 08:50:55 +01:00
parent 122873ce4e
commit d0bd391073

View file

@ -160,6 +160,12 @@ function Main() {
PrintDB(item); PrintDB(item);
}); });
var olds = [];
if (dbs.length == 1) {
for ( let i = 0; i < dbs[0].length; i++)
olds.push(dbs[0].Subjects[i].length);
}
console.log("Parsed data count: " + dbs.length); console.log("Parsed data count: " + dbs.length);
PrintLN(); PrintLN();
@ -170,7 +176,7 @@ function Main() {
var r = RemoveDuplicates(db); var r = RemoveDuplicates(db);
console.log("RESULT:"); console.log("RESULT:");
PrintDB(r); PrintDB(r, olds);
utils.WriteFile(JSON.stringify(r), "newData"); utils.WriteFile(JSON.stringify(r), "newData");
console.log("File written!"); console.log("File written!");
@ -180,7 +186,7 @@ function PrintLN() {
console.log("------------------------------------------------------"); console.log("------------------------------------------------------");
} }
function PrintDB(r) { function PrintDB(r, olds) {
console.log("Data subject count: " + r.length); console.log("Data subject count: " + r.length);
var maxLength = 0; var maxLength = 0;
for (var i = 0; i < r.length; i++) { for (var i = 0; i < r.length; i++) {
@ -188,8 +194,6 @@ function PrintDB(r) {
maxLength = r.Subjects[i].Name.length; maxLength = r.Subjects[i].Name.length;
} }
console.log("MAXL" + maxLength);
for (var i = 0; i < r.length; i++) { for (var i = 0; i < r.length; i++) {
let line = i; let line = i;
if (line < 10) if (line < 10)
@ -206,6 +210,17 @@ function PrintDB(r) {
line += " "; line += " ";
} }
if (olds && olds.length > 0) {
// TODO: check if correct row! should be now, but well...
if (olds[i] < 10)
line += " ";
if (olds[i] < 100)
line += " ";
line += olds[i];
line += " -> ";
}
if (r.Subjects[i].length < 10) if (r.Subjects[i].length < 10)
line += " "; line += " ";
if (r.Subjects[i].length < 100) if (r.Subjects[i].length < 100)