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 WHERE MONTH(calldate) = MONTH(?) AND YEAR(calldate) = YEAR(?);
|
||||||
SELECT COUNT(*) AS call_count FROM cdr;
|
SELECT COUNT(*) AS call_count FROM cdr;
|
||||||
`, [startTime, endTime, previousDay, previousDay, previousDay], (err, res) => {
|
`, [startTime, endTime, previousDay, previousDay, previousDay], (err, res) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
callsMade = res[0]
|
callsMade = res[0]
|
||||||
recordForToday = res[1]
|
recordForToday = res[1]
|
||||||
monthlyTotal = res[2]
|
monthlyTotal = res[2]
|
||||||
totalCalls = res[3]
|
totalCalls = res[3]
|
||||||
});
|
connection.end();
|
||||||
|
return {
|
||||||
await connection.end();
|
"Calls Made": callsMade[0].call_count,
|
||||||
console.log(callsMade)
|
"Record for Today of the Year": recordForToday[0].call_count,
|
||||||
console.log(recordForToday)
|
"Monthly Total": monthlyTotal[0].call_count,
|
||||||
return {
|
"Total Calls Ever Placed": totalCalls[0].call_count,
|
||||||
"Calls Made": callsMade[0].call_count,
|
"System Uptime": getSystemUptime(),
|
||||||
"Record for Today of the Year": recordForToday[0].call_count,
|
"All Time Record": null, // Placeholder
|
||||||
"Monthly Total": monthlyTotal[0].call_count,
|
};
|
||||||
"Total Calls Ever Placed": totalCalls[0].call_count,
|
});
|
||||||
"System Uptime": getSystemUptime(),
|
|
||||||
"All Time Record": null, // Placeholder
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSystemUptime() {
|
function getSystemUptime() {
|
||||||
|
@ -118,7 +115,7 @@ async function sendSummary() {
|
||||||
previousDayEnd.setHours(23, 59, 59, 999);
|
previousDayEnd.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
let embed = {
|
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,
|
color: 0x1E90FF,
|
||||||
fields: []
|
fields: []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue