Merge branch 'feature/list_according_serail'

This commit is contained in:
2024-10-05 16:49:15 +02:00
4 changed files with 22 additions and 7 deletions
+14 -1
View File
@@ -118,6 +118,16 @@ function shuffle(array) {
return array; return array;
} }
function getContactListForDevice(device, allContactList) {
let contactList = [];
allContactList.forEach((contact) => {
if (contact.serial === device.serial) {
contactList.push(contact)
}
})
return contactList;
}
async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = true, alertBeep = false) { async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = true, alertBeep = false) {
console.log("startBookWithNumbers() called, with alertBeep:" + alertBeep) console.log("startBookWithNumbers() called, with alertBeep:" + alertBeep)
console.log("startBookWithNumbers() called, with audioAnalyse:" + audioAnalyse) console.log("startBookWithNumbers() called, with audioAnalyse:" + audioAnalyse)
@@ -191,7 +201,10 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
for (let i = 0; i < filteredDeviceList.length; i++) { for (let i = 0; i < filteredDeviceList.length; i++) {
let device = filteredDeviceList[i]; let device = filteredDeviceList[i];
let port = startForwordingForDevice(device) let port = startForwordingForDevice(device)
startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port); let _contactList = listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1))
// let _contactList = getContactListForDevice(device, listWithoutBlackContact)
console.log("contactList: for device:" + device.serial + " has " + _contactList.length)
startWithList(_contactList, device, sender, selectedStore, audioAnalyse, alertBeep, port);
} }
}) })
+3 -2
View File
@@ -19,11 +19,12 @@ class ExcelUtil {
if (store === undefined || store.length === 0) { if (store === undefined || store.length === 0) {
store = "random" store = "random"
} }
let ipCountry = info[5]; let serial = info[5];
let ipCountry = info[6];
if (ipCountry === undefined || ipCountry.length === 0) { if (ipCountry === undefined || ipCountry.length === 0) {
ipCountry = "FR" ipCountry = "FR"
} }
let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry); let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry, serial);
contactList.push(newContact); contactList.push(newContact);
} }
} }
+2 -1
View File
@@ -1,6 +1,6 @@
class ContactPojo { class ContactPojo {
constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry) { constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry, serial) {
this.phoneNumber = phoneNumber; this.phoneNumber = phoneNumber;
this.passportNumber = passportNumber; this.passportNumber = passportNumber;
this.lastName = lastName; this.lastName = lastName;
@@ -8,6 +8,7 @@ class ContactPojo {
this.mail = mail; this.mail = mail;
this.store = store; this.store = store;
this.ipCountry = ipCountry; this.ipCountry = ipCountry;
this.serial = serial;
} }
} }
+3 -3
View File
@@ -1354,8 +1354,8 @@ class CommandorPage {
this.device.shell("input tap " + 925 + " " + 1325) this.device.shell("input tap " + 925 + " " + 1325)
} else if (this.device.model === "22041219PG") { } else if (this.device.model === "22041219PG") {
this.device.shell("input tap " + 925 + " " + 1430) this.device.shell("input tap " + 925 + " " + 1430)
} else if (this.device.model === "moto g51 5G") { } else if (this.device.model === "moto_g51_5G") {
await this.tapForDevice(this.device, 950, 1434) this.device.shell("input tap " + 950 + " " + 1434)
} else } else
this.device.shell("input tap " + 933 + " " + 1538) this.device.shell("input tap " + 933 + " " + 1538)
await delay(2000); await delay(2000);
@@ -1417,7 +1417,7 @@ class CommandorPage {
this.device.shell("input tap " + 818 + " " + 2140) this.device.shell("input tap " + 818 + " " + 2140)
await delay(1000); await delay(1000);
} else if (model === "moto_g51_5G") { } else if (model === "moto_g51_5G") {
await this.tapForDevice(this.device, 800, 2215) this.device.shell("input tap " + 806 + " " + 2230)
await delay(2000); await delay(2000);
this.device.shell("input tap " + 800 + " " + 2215) this.device.shell("input tap " + 800 + " " + 2215)
await delay(1000); await delay(1000);