Move stuff
This commit is contained in:
parent
fb866169e8
commit
0da00e5efb
41
index.js
41
index.js
|
@ -47,27 +47,24 @@ async function getPreviousDayData() {
|
|||
SELECT COUNT(*) AS call_count FROM cdr WHERE MONTH(calldate) = MONTH(?) AND YEAR(calldate) = YEAR(?);
|
||||
SELECT COUNT(*) AS call_count FROM cdr;
|
||||
`, [startTime, endTime, previousDay, previousDay, previousDay], (err, res) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
callsMade = res[0]
|
||||
recordForToday = res[1]
|
||||
monthlyTotal = res[2]
|
||||
totalCalls = res[3]
|
||||
});
|
||||
|
||||
await connection.end();
|
||||
console.log(callsMade)
|
||||
console.log(recordForToday)
|
||||
return {
|
||||
"Calls Made": callsMade[0].call_count,
|
||||
"Record for Today of the Year": recordForToday[0].call_count,
|
||||
"Monthly Total": monthlyTotal[0].call_count,
|
||||
"Total Calls Ever Placed": totalCalls[0].call_count,
|
||||
"System Uptime": getSystemUptime(),
|
||||
"All Time Record": null, // Placeholder
|
||||
};
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
callsMade = res[0]
|
||||
recordForToday = res[1]
|
||||
monthlyTotal = res[2]
|
||||
totalCalls = res[3]
|
||||
connection.end();
|
||||
return {
|
||||
"Calls Made": callsMade[0].call_count,
|
||||
"Record for Today of the Year": recordForToday[0].call_count,
|
||||
"Monthly Total": monthlyTotal[0].call_count,
|
||||
"Total Calls Ever Placed": totalCalls[0].call_count,
|
||||
"System Uptime": getSystemUptime(),
|
||||
"All Time Record": null, // Placeholder
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function getSystemUptime() {
|
||||
|
@ -118,7 +115,7 @@ async function sendSummary() {
|
|||
previousDayEnd.setHours(23, 59, 59, 999);
|
||||
|
||||
let embed = {
|
||||
title: `Summary from <t:${Math.floor(previousDayStart/1000)}:f> to <t:${Math.floor(previousDayEnd/1000)}:f>`,
|
||||
title: `Summary from <t:${Math.floor(previousDayStart / 1000)}:f> to <t:${Math.floor(previousDayEnd / 1000)}:f>`,
|
||||
color: 0x1E90FF,
|
||||
fields: []
|
||||
|
||||
|
|
Loading…
Reference in a new issue