Skip to content

Commit

Permalink
Update compare_drill_aggregated_csv.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeghana authored Nov 29, 2024
1 parent d9c1bb0 commit 4f63fb6
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions bin/scripts/data-reports/compare_drill_aggregated.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
let percentageDiff = 0;
if (drillCount !== 0) {
percentageDiff = ((drillCount - aggCount) / drillCount) * 100;
} else {
}
else {
if (aggCount !== 0) {
// If drillCount is 0, and aggCount is not 0, show a large difference
percentageDiff = (aggCount > 0 ? 100 : -100); // 100% or -100% depending on the sign of aggCount
} else {
}
else {
percentageDiff = 0; // Both counts are 0, no difference
}
}
Expand Down Expand Up @@ -207,7 +209,8 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
console.log(eee);
reject();
});
} else {
}
else {
console.log("No events in the App");
console.log("---------------------------------");
resolve();
Expand Down Expand Up @@ -235,7 +238,8 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("

console.log(JSON.stringify(endReport));
close();
} catch (err) {
}
catch (err) {
console.error("Failed to save partial report:", err);
}
}).catch(function(eee) {
Expand All @@ -256,17 +260,20 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
}
fs.writeFileSync(path, csvRows.join("\n"));
console.log("Partial summary report saved to '" + path + "'.");
} catch (err) {
}
catch (err) {
console.error("Failed to save partial report:", err);
}
return close();
});
}
function close() {
try {
if (countlyDb?.close) { countlyDb.close();
if (countlyDb?.close) {
countlyDb.close();
}
if (drillDb?.close) { drillDb.close();
if (drillDb?.close) {
drillDb.close();
}
}
catch (err) {
Expand Down Expand Up @@ -322,7 +329,8 @@ function getDataFromDrill(options, callback) {
result.totals.dur += data[z].dur || 0;
}
}
} else {
}
else {
console.log("No drill data found for event:", options.event);
}
callback(err, result);
Expand Down

0 comments on commit 4f63fb6

Please sign in to comment.