more fields
This commit is contained in:
+13
-11
@@ -5,25 +5,27 @@ const {MongoManager, formatDate} = require("./workers/mongo_manager");
|
|||||||
const alert = require('alert');
|
const alert = require('alert');
|
||||||
const schedule = require("node-schedule");
|
const schedule = require("node-schedule");
|
||||||
const DeviceExcludeMode = require("./models/DeviceExcludeMode");
|
const DeviceExcludeMode = require("./models/DeviceExcludeMode");
|
||||||
const Sender = require("./queue/Sender");
|
const {Sender} = require("./queue/Sender");
|
||||||
const mongoManager = new MongoManager();
|
const mongoManager = new MongoManager();
|
||||||
const SEVEN_DAYS_IN_S = 3600 * 24 * 7;
|
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;
|
const NINETY_DAYS_IN_S = 30 * 3;
|
||||||
let excelUtil = new ExcelUtil();
|
let excelUtil = new ExcelUtil();
|
||||||
let collectionName = formatDate(new Date())
|
let collectionName = formatDate(new Date())
|
||||||
let excludeMode = DeviceExcludeMode.THREE
|
let excludeMode = DeviceExcludeMode.ZERO
|
||||||
let three_to_excludes = []
|
|
||||||
|
let three_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752"]
|
||||||
let four_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518"]
|
let four_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518"]
|
||||||
let seven_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
let seven_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
||||||
let six_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752", "07fbd156", "NFD669QK8XNFSCNN", "6X494TTWQGFALB79", "71a0371d", "YP6HVKLFE67T598L"]
|
let six_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752", "07fbd156", "NFD669QK8XNFSCNN", "6X494TTWQGFALB79", "71a0371d", "YP6HVKLFE67T598L"]
|
||||||
let nine_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "47e7e36b", "p7d6nbw8cu7duous", "njzxojhim7gedyvw", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "EPHUT20825001518", "W8GMFELRHIKZS84T"]
|
let nine_to_excludes = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "47e7e36b", "p7d6nbw8cu7duous", "njzxojhim7gedyvw", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "EPHUT20825001518"]
|
||||||
let for_scrpay = ["07fbd156", "47e7e36b", "4f55c3d4", "5ac879a2", "69db59f0", "71a0371d", "774687ff", "7b71fb20", "8f76f9e7", "99cyfiaebqcy6poj", "EPHUT20825001518", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "ai9xv8hy599hvkee", "b41c1b72", "bec11752", "becb6e99", "c3ba032e", "d54e946", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "fy65eqs4wkvcpf9h", "hi7ljr5xduyt9pfi", "njzxojhim7gedyvw", "p7d6nbw8cu7duous"]
|
let for_scrpay = ["07fbd156", "47e7e36b", "4f55c3d4", "5ac879a2", "69db59f0", "71a0371d", "774687ff", "7b71fb20", "8f76f9e7", "99cyfiaebqcy6poj", "EPHUT20825001518", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "ai9xv8hy599hvkee", "b41c1b72", "bec11752", "becb6e99", "c3ba032e", "d54e946", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "fy65eqs4wkvcpf9h", "hi7ljr5xduyt9pfi", "njzxojhim7gedyvw", "p7d6nbw8cu7duous"]
|
||||||
attributedPorts = []
|
attributedPorts = []
|
||||||
const device_port_info = new Map();
|
const device_port_info = new Map();
|
||||||
startPort = 9000
|
startPort = 9000
|
||||||
|
|
||||||
async function filterAlreadyBookedContacts(contactList) {
|
async function filterAlreadyBookedContacts(contactList) {
|
||||||
|
console.log("getAllSuccessfulItemsForDay()")
|
||||||
let alreadyBookedContacts = await mongoManager.getAllSuccessfulItemsForDay(collectionName);
|
let alreadyBookedContacts = await mongoManager.getAllSuccessfulItemsForDay(collectionName);
|
||||||
let contactsToBook = [];
|
let contactsToBook = [];
|
||||||
contactList.forEach((contact) => {
|
contactList.forEach((contact) => {
|
||||||
@@ -221,10 +223,8 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
|||||||
console.log("connect to mongodb")
|
console.log("connect to mongodb")
|
||||||
mongoManager.connect().then(r => {
|
mongoManager.connect().then(r => {
|
||||||
console.log("successfully connected to mongodb")
|
console.log("successfully connected to mongodb")
|
||||||
|
filterAlreadyBookedContacts(contactList).then((listWithoutBlackContact) => {
|
||||||
filterAlreadyBookedContacts(contactList).then((listToBook) => {
|
console.log("will call filterAlreadyAcceptedContacts")
|
||||||
filterAlreadyAcceptedContacts(listToBook).then(notAcceptedContacts => {
|
|
||||||
filterBlacklistedContacts(notAcceptedContacts).then(listWithoutBlackContact => {
|
|
||||||
console.log("number of contacts to book:" + listWithoutBlackContact.length)
|
console.log("number of contacts to book:" + listWithoutBlackContact.length)
|
||||||
android.devices().then((devices) => {
|
android.devices().then((devices) => {
|
||||||
if (devices.length === 0) {
|
if (devices.length === 0) {
|
||||||
@@ -234,12 +234,16 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
|||||||
let device_to_excludes = three_to_excludes;
|
let device_to_excludes = three_to_excludes;
|
||||||
if (excludeMode === DeviceExcludeMode.FOUR) {
|
if (excludeMode === DeviceExcludeMode.FOUR) {
|
||||||
device_to_excludes = four_to_excludes;
|
device_to_excludes = four_to_excludes;
|
||||||
|
} else if (excludeMode === DeviceExcludeMode.THREE) {
|
||||||
|
device_to_excludes = three_to_excludes;
|
||||||
} else if (excludeMode === DeviceExcludeMode.NINE) {
|
} else if (excludeMode === DeviceExcludeMode.NINE) {
|
||||||
device_to_excludes = nine_to_excludes;
|
device_to_excludes = nine_to_excludes;
|
||||||
} else if (excludeMode === DeviceExcludeMode.SEVEN) {
|
} else if (excludeMode === DeviceExcludeMode.SEVEN) {
|
||||||
device_to_excludes = seven_to_excludes
|
device_to_excludes = seven_to_excludes
|
||||||
} else if (excludeMode === DeviceExcludeMode.SIX) {
|
} else if (excludeMode === DeviceExcludeMode.SIX) {
|
||||||
device_to_excludes = six_to_excludes
|
device_to_excludes = six_to_excludes
|
||||||
|
} else if (excludeMode === DeviceExcludeMode.ZERO) {
|
||||||
|
device_to_excludes = []
|
||||||
}
|
}
|
||||||
filteredDeviceList = devices.filter(device => !device_to_excludes.includes(device.serial()))
|
filteredDeviceList = devices.filter(device => !device_to_excludes.includes(device.serial()))
|
||||||
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
|
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
|
||||||
@@ -251,9 +255,7 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
|||||||
startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port);
|
startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user