add new fun to generate profiles

This commit is contained in:
Lei PAN
2022-05-29 22:20:25 +02:00
parent f303c33752
commit d45f78c44a
5 changed files with 113 additions and 18 deletions
+16 -16
View File
@@ -19,32 +19,32 @@ def get_random_id_number() -> str:
def write_the_valid_profiles_to_excel():
day_list = ['2022-03-23','2022-03-24','2022-03-25']
day_list = ['2022-05-28']
collection = []
for day in day_list:
collection.extend(params.firebase_store_manager.get_all_successful_items_for_day(day).stream())
collection.extend(params.firebase_store_manager.get_all_successful_items_for_day(day, source_from=None).stream())
valid_contacts = []
# exist_contacts = ExcelHelper().read_contacts()
for valid_appointment in collection:
reserve_pojo = ReserveResultPojo.from_firestore_dict(valid_appointment.to_dict())
# check whether the contact exists already
exist = [contact for contact in valid_contacts if contact.mail == reserve_pojo.email]
if len(exist) == 0:
contact = ContactPojo(reserve_pojo.phone, passport_number=get_random_id_number(),
last_name=reserve_pojo.lastName, first_name=reserve_pojo.firstName, ccid="",
mail=reserve_pojo.email, position=0)
# seed = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
# contact.passport = get_random_id_number()
# if contact.passport == None or len(contact.passport) == 0:
# old_contact = [item for item in exist_contacts if item.mail == contact.mail]
# if len(old_contact) > 0:
# contact.passport = old_contact[0].passport
# exist = [contact for contact in valid_contacts if contact.mail == reserve_pojo.email]
# if len(exist) == 0:
contact = ContactPojo(reserve_pojo.phone, passport_number=get_random_id_number(),
last_name=reserve_pojo.lastName, first_name=reserve_pojo.firstName, ccid="",
mail=reserve_pojo.email, position=0)
# seed = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
# contact.passport = get_random_id_number()
# if contact.passport == None or len(contact.passport) == 0:
# old_contact = [item for item in exist_contacts if item.mail == contact.mail]
# if len(old_contact) > 0:
# contact.passport = old_contact[0].passport
print(contact)
valid_contacts.append(contact)
print(contact)
valid_contacts.append(contact)
row = 0
col = 0