manage accepted appointments
This commit is contained in:
@@ -112,3 +112,8 @@ adb -s c3ba032e shell am start -n com.android.chrome/com.google.android.apps.chr
|
||||
adb -s 2140c70c shell pm clear com.android.chrome
|
||||
adb -s 2140c70c shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 2140c70c shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#asus zenfone 3
|
||||
adb -s G7AZCY07H415CT3 shell pm clear com.android.chrome
|
||||
adb -s G7AZCY07H415CT3 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s G7AZCY07H415CT3 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
@@ -92,3 +92,8 @@ adb -s 192.168.1.24:42397 shell am start -n com.android.chrome/com.google.androi
|
||||
adb -s 2140c70c shell pm clear com.android.chrome
|
||||
adb -s 2140c70c shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 2140c70c shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#asus zenfone 3
|
||||
adb -s G7AZCY07H415CT3 shell pm clear com.android.chrome
|
||||
adb -s G7AZCY07H415CT3 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s G7AZCY07H415CT3 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
+21
-5
@@ -6,6 +6,7 @@ const alert = require('alert');
|
||||
|
||||
const mongoManager = new MongoManager();
|
||||
const SEVEN_DAYS_IN_S = 3600 * 24 * 7;
|
||||
const THIRTY_DAYS_IN_S = 3600 * 24 * 30;
|
||||
let excelUtil = new ExcelUtil();
|
||||
let collectionName = formatDate(new Date())
|
||||
|
||||
@@ -24,8 +25,10 @@ async function filterAlreadyBookedContacts(contactList) {
|
||||
// Connect to the device.
|
||||
|
||||
async function needToBook(contact, mongoManager) {
|
||||
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName)
|
||||
let blackListItems = await mongoManager.getAllBlackedListItems()
|
||||
console.log("check contact with email " + contact.mail)
|
||||
let alreadyBooked = await mongoManager.getAllSuccessfulItemsForDay(collectionName);
|
||||
let blackListItems = await mongoManager.getAllBlackedListItems();
|
||||
let alreadyAcceptedItems = await mongoManager.getAllAcceptedAppointments();
|
||||
let needToBook = true;
|
||||
await alreadyBooked.forEach((bookedItem) => {
|
||||
if (bookedItem.email === contact.mail) {
|
||||
@@ -36,12 +39,25 @@ async function needToBook(contact, mongoManager) {
|
||||
if (needToBook) {
|
||||
await blackListItems.forEach((blackListItem) => {
|
||||
if (blackListItem.mail === contact.mail) {
|
||||
console.log("=====handle blacklist item====")
|
||||
console.log("=====handle blacklist item====");
|
||||
console.log("update_at_s is " + blackListItem.update_at_in_s)
|
||||
console.log("email is " + blackListItem.mail)
|
||||
console.log("black list email is " + blackListItem.mail)
|
||||
needToBook = blackListItem.update_at_in_s + SEVEN_DAYS_IN_S <= (new Date()) / 1000;
|
||||
if (!needToBook) {
|
||||
console.log("skip")
|
||||
console.log("contact in blacklist -->skip");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (needToBook) {
|
||||
await alreadyAcceptedItems.forEach((acceptedItem) => {
|
||||
if (acceptedItem.email === contact.mail) {
|
||||
console.log("=====handle already accepted item====");
|
||||
console.log("accepted_at is " + acceptedItem.accepted_at);
|
||||
console.log("accepted email is " + acceptedItem.email);
|
||||
needToBook = acceptedItem.accepted_at + THIRTY_DAYS_IN_S <= (new Date()) / 1000;
|
||||
if (!needToBook) {
|
||||
console.log("already accepted appointment --> skip");
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+11
-5
@@ -5,11 +5,17 @@ const mongoManager = new MongoManager();
|
||||
|
||||
|
||||
mongoManager.connect().then(r => {
|
||||
let contact = new ContactPojo("0649614591", "1234567890", "PAN", "Lei", "panleicim@gmail.com")
|
||||
let commandPage = new CommandorPage(contact, null, mongoManager)
|
||||
commandPage.deleteFromBlackList().then(r => {
|
||||
console.log("saved to db")
|
||||
// let contact = new ContactPojo("0649614591", "1234567890", "PAN", "Lei", "panleicim@gmail.com")
|
||||
// let commandPage = new CommandorPage(contact, null, mongoManager)
|
||||
// commandPage.deleteFromBlackList().then(r => {
|
||||
// console.log("saved to db")
|
||||
// })
|
||||
mongoManager.getAllAcceptedAppointments().then(acceptedList => {
|
||||
acceptedList.forEach((item) => {
|
||||
console.log(item.email)
|
||||
console.log(item.accepted_at)
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -7,7 +7,7 @@ const {
|
||||
shell
|
||||
} = require('electron')
|
||||
const GeoCaptchaSolver = require("./GeoCaptchaSolver");
|
||||
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
|
||||
// const RDV_URL = "http://192.168.0.41:8000/test_appointment.html"
|
||||
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
|
||||
BLANK_URL = "about:blank"
|
||||
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
|
||||
|
||||
@@ -41,6 +41,10 @@ class MongoManager {
|
||||
return await this.db.collection(day).find().toArray()
|
||||
}
|
||||
|
||||
async getAllAcceptedAppointments() {
|
||||
return await this.db.collection(ACCEPTED_APPOINTMENT_LIST).find().toArray()
|
||||
}
|
||||
|
||||
async saveReserveToDb(reservePojo) {
|
||||
let collectionName = formatDate(new Date())
|
||||
return await this.db.collection(collectionName).replaceOne({'_id': reservePojo.id,}, reservePojo, {upsert: true})
|
||||
|
||||
Reference in New Issue
Block a user