correction for blacklist
This commit is contained in:
+7
-5
@@ -26,23 +26,25 @@ async function filterAlreadyBookedContacts(contactList) {
|
|||||||
async function needToBook(contact, mongoManager) {
|
async function needToBook(contact, mongoManager) {
|
||||||
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName)
|
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName)
|
||||||
let blackListItems = await mongoManager.getAllBlackedListItems()
|
let blackListItems = await mongoManager.getAllBlackedListItems()
|
||||||
let toReturn = true;
|
let needToBook = true;
|
||||||
await alreadyBooked.forEach((bookedItem) => {
|
await alreadyBooked.forEach((bookedItem) => {
|
||||||
if (bookedItem.email === contact.mail) {
|
if (bookedItem.email === contact.mail) {
|
||||||
toReturn = false;
|
needToBook = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if (needToBook) {
|
||||||
await blackListItems.forEach((blackListItem) => {
|
await blackListItems.forEach((blackListItem) => {
|
||||||
console.log("=====handle blacklist item====")
|
console.log("=====handle blacklist item====")
|
||||||
console.log("update_at_s is " + blackListItem.update_at_in_s)
|
console.log("update_at_s is " + blackListItem.update_at_in_s)
|
||||||
console.log("email is " + blackListItem.mail)
|
console.log("email is " + blackListItem.mail)
|
||||||
toReturn = blackListItem.update_at_in_s <= (new Date()) + SEVEN_DAYS_IN_S;
|
needToBook = blackListItem.update_at_in_s <= (new Date()) + SEVEN_DAYS_IN_S;
|
||||||
if (!toReturn) {
|
if (!needToBook) {
|
||||||
console.log("skip")
|
console.log("skip")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return toReturn
|
}
|
||||||
|
return needToBook
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startBook(contactPojo, device, selectedStore, audioAnalyse, alertBeep) {
|
async function startBook(contactPojo, device, selectedStore, audioAnalyse, alertBeep) {
|
||||||
|
|||||||
Reference in New Issue
Block a user