mirror of
				https://gitlab.com/MrFry/mrfrys-node-server
				synced 2025-04-01 20:24:18 +02:00 
			
		
		
		
	Even more fancier merger output
This commit is contained in:
		
							
								
								
									
										23
									
								
								merger.js
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								merger.js
									
									
									
									
									
								
							@@ -160,6 +160,12 @@ function Main() {
 | 
			
		||||
		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);
 | 
			
		||||
	PrintLN();
 | 
			
		||||
 | 
			
		||||
@@ -170,7 +176,7 @@ function Main() {
 | 
			
		||||
	var r = RemoveDuplicates(db);
 | 
			
		||||
 | 
			
		||||
	console.log("RESULT:");
 | 
			
		||||
	PrintDB(r);
 | 
			
		||||
	PrintDB(r, olds);
 | 
			
		||||
 | 
			
		||||
	utils.WriteFile(JSON.stringify(r), "newData");
 | 
			
		||||
	console.log("File written!");
 | 
			
		||||
@@ -180,7 +186,7 @@ function PrintLN() {
 | 
			
		||||
	console.log("------------------------------------------------------");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function PrintDB(r) {
 | 
			
		||||
function PrintDB(r, olds) {
 | 
			
		||||
	console.log("Data subject count: " + r.length);
 | 
			
		||||
	var maxLength = 0;
 | 
			
		||||
	for (var i = 0; i < r.length; i++) {
 | 
			
		||||
@@ -188,8 +194,6 @@ function PrintDB(r) {
 | 
			
		||||
			maxLength = r.Subjects[i].Name.length;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	console.log("MAXL" + maxLength);
 | 
			
		||||
 | 
			
		||||
	for (var i = 0; i < r.length; i++) {
 | 
			
		||||
		let line = i;
 | 
			
		||||
		if (line < 10)
 | 
			
		||||
@@ -206,6 +210,17 @@ function PrintDB(r) {
 | 
			
		||||
				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)
 | 
			
		||||
			line += " ";
 | 
			
		||||
		if (r.Subjects[i].length < 100)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user