test check blacklist
This commit is contained in:
+11
-1
@@ -5,7 +5,7 @@ const {MongoManager, formatDate} = require("./workers/mongo_manager");
|
||||
const alert = require('alert');
|
||||
|
||||
const mongoManager = new MongoManager();
|
||||
|
||||
const SEVEN_DAYS_IN_S = 3600 * 24 * 7;
|
||||
let excelUtil = new ExcelUtil();
|
||||
let collectionName = formatDate(new Date())
|
||||
|
||||
@@ -25,6 +25,7 @@ async function filterAlreadyBookedContacts(contactList) {
|
||||
|
||||
async function needToBook(contact, mongoManager) {
|
||||
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName)
|
||||
let blackListItems = await mongoManager.getAllBlackedListItems()
|
||||
let toReturn = true;
|
||||
await alreadyBooked.forEach((bookedItem) => {
|
||||
if (bookedItem.email === contact.mail) {
|
||||
@@ -32,6 +33,15 @@ async function needToBook(contact, mongoManager) {
|
||||
}
|
||||
}
|
||||
)
|
||||
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) {
|
||||
console.log("skip")
|
||||
}
|
||||
})
|
||||
return toReturn
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user