Error logging, go back 2 years and 0 contact
handling
This commit is contained in:
parent
51f68d5021
commit
4650a4d5a3
@ -116,7 +116,7 @@ router.get("/", (req, res) => {
|
||||
}
|
||||
}`;
|
||||
var startTime = new Date(
|
||||
new Date().setFullYear(new Date().getFullYear() - 1)
|
||||
new Date().setFullYear(new Date().getFullYear() - 2)
|
||||
);
|
||||
var endTime = new Date(new Date().setHours(new Date().getHours() - 1));
|
||||
|
||||
@ -136,6 +136,17 @@ router.get("/", (req, res) => {
|
||||
)
|
||||
.then((result) => {
|
||||
var contacts = result.data.data.findContactsCompletedBetween.edges;
|
||||
|
||||
// Log error to console
|
||||
if (result.data.errors && result.data.errors.length > 0) {
|
||||
result.data.errors.forEach(function (error, i) {
|
||||
console.log("ERROR: Errors in results - " + error.message);
|
||||
});
|
||||
|
||||
// TODO: Should keep errors for filteredContacts
|
||||
result.data.errors = [];
|
||||
}
|
||||
|
||||
var filteredContacts = [];
|
||||
contacts.forEach(function (contact, i) {
|
||||
if (contact.node.interaction.__typename === "Email") {
|
||||
@ -162,6 +173,7 @@ router.get("/", (req, res) => {
|
||||
summary.totalInboundCount = 0;
|
||||
summary.totalInboundActiveSeconds = 0;
|
||||
|
||||
if (summary.totalCount > 0) {
|
||||
summary.firstContactReceivedDate = new Date(
|
||||
filteredContacts[0].node.interaction.receivedDate
|
||||
);
|
||||
@ -195,7 +207,7 @@ router.get("/", (req, res) => {
|
||||
(summary.lastContactEndTime.getTime() -
|
||||
summary.firstInboundContactStartDate.getTime()) /
|
||||
(1000 * 60);
|
||||
|
||||
}
|
||||
result.data.data.summary = summary;
|
||||
|
||||
if (result.data) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user