add ExcludeMode SEVEN
This commit is contained in:
+12
-8
@@ -8,14 +8,16 @@ const DeviceExcludeMode = require("./models/DeviceExcludeMode");
|
||||
|
||||
const mongoManager = new MongoManager();
|
||||
const SEVEN_DAYS_IN_S = 3600 * 24 * 7;
|
||||
const NINETY_DAYS_IN_S = 3600 * 24 * 30 * 3;
|
||||
// const NINETY_DAYS_IN_S = 3600 * 24 * 30 * 3;
|
||||
const NINETY_DAYS_IN_S = 30 * 3;
|
||||
let excelUtil = new ExcelUtil();
|
||||
let collectionName = formatDate(new Date())
|
||||
let excludeMode = DeviceExcludeMode.THREE
|
||||
let three_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518"]
|
||||
let four_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "e30eb015", "EPHUT20825001518"]
|
||||
let nine_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "e30eb015", "47e7e36b", "p7d6nbw8cu7duous", "njzxojhim7gedyvw", "fmiz5pa6rsx4u4ts", "fy65eqs4wkvcpf9h", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
||||
|
||||
let excludeMode = DeviceExcludeMode.SEVEN
|
||||
let three_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518"]
|
||||
let four_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "e30eb015", "EPHUT20825001518"]
|
||||
let seven_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "e30eb015", "EPHUT20825001518", "bec11752", "fy65eqs4wkvcpf9h", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
||||
let nine_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "e30eb015", "47e7e36b", "p7d6nbw8cu7duous", "njzxojhim7gedyvw", "fmiz5pa6rsx4u4ts", "fy65eqs4wkvcpf9h", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
||||
let for_scrpay = ["07fbd156", "47e7e36b", "4f55c3d4", "5ac879a2", "69db59f0", "71a0371d", "774687ff", "7b71fb20", "8f76f9e7", "99cyfiaebqcy6poj", "EPHUT20825001518", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "ai9xv8hy599hvkee", "b41c1b72", "bec11752", "becb6e99", "c3ba032e", "d54e946", "e30eb015", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "fy65eqs4wkvcpf9h", "hi7ljr5xduyt9pfi", "njzxojhim7gedyvw", "p7d6nbw8cu7duous"]
|
||||
attributedPorts = []
|
||||
const device_port_info = new Map();
|
||||
startPort = 9000
|
||||
@@ -80,7 +82,8 @@ async function filterBlacklistedContacts(contactList) {
|
||||
async function needToBook(contact, mongoManager) {
|
||||
console.log("check contact with email " + contact.mail)
|
||||
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName);
|
||||
let blackListItems = await mongoManager.getAllBlackedListItems();
|
||||
// let blackListItems = await mongoManager.getAllBlackedListItems();
|
||||
let blackListItems = [];
|
||||
let alreadyAcceptedItems = await mongoManager.getAllAcceptedAppointments();
|
||||
let needToBook = true;
|
||||
await alreadyBooked.forEach((bookedItem) => {
|
||||
@@ -132,7 +135,6 @@ async function startBook(contactPojo, device, selectedStore, audioAnalyse, alert
|
||||
|
||||
async function startWithList(contacts, device, selectedStore, audioAnalyse, alertBeep, port) {
|
||||
let duplicatedList = [].concat(contacts).concat(contacts).concat(contacts)
|
||||
// let duplicatedList = [].concat(contacts)
|
||||
await duplicatedList.reduce(async (promise, contactPojo) => {
|
||||
// This line will wait for the last async function to finish.
|
||||
// The first iteration uses an already resolved Promise
|
||||
@@ -220,6 +222,8 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
||||
device_to_excludes = four_to_excludes;
|
||||
} else if (excludeMode === DeviceExcludeMode.NINE) {
|
||||
device_to_excludes = nine_to_excludes;
|
||||
} else if (excludeMode === DeviceExcludeMode.SEVEN) {
|
||||
device_to_excludes = seven_to_excludes
|
||||
}
|
||||
filteredDeviceList = devices.filter(device => !device_to_excludes.includes(device.serial()))
|
||||
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const DeviceExcludeMode = {
|
||||
NINE: Symbol("NINE"),
|
||||
THREE: Symbol("THREE"),
|
||||
SEVEN: Symbol("SEVEN"),
|
||||
FOUR: Symbol("FOUR")
|
||||
}
|
||||
module.exports = DeviceExcludeMode
|
||||
Reference in New Issue
Block a user