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