delete used file
This commit is contained in:
Regular → Executable
+7
-7
@@ -22,14 +22,14 @@ def decode(s: str) -> str:
|
||||
return bytes(res).decode('gb2312')
|
||||
|
||||
|
||||
chinese_name = "陈欣宁"
|
||||
first_name = "xinning"
|
||||
last_name = "chen"
|
||||
passport_number = "E60999212"
|
||||
birth_day = "970115"
|
||||
chinese_name = "鲁思思"
|
||||
first_name = "sisi"
|
||||
last_name = "lu"
|
||||
passport_number = "E96619397"
|
||||
birth_day = "981215"
|
||||
sex = "F"
|
||||
# sex = "M"
|
||||
expire_date = "280116"
|
||||
expire_date = "290116"
|
||||
|
||||
encoded_chinese_name = encode(chinese_name)
|
||||
print(encoded_chinese_name)
|
||||
@@ -38,7 +38,7 @@ for i in range(0, optional_data_length):
|
||||
encoded_chinese_name = encoded_chinese_name + "<"
|
||||
|
||||
# optinal_data = "MFMLMANK<<<<A9" #14位
|
||||
# nationality = "CHN"
|
||||
# nationality = "TWN"
|
||||
nationality = "CHN"
|
||||
if nationality == "TWN":
|
||||
optinal_data = "I100217437" # 14位
|
||||
Regular → Executable
@@ -1,73 +0,0 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
import xlsxwriter
|
||||
|
||||
from src import definitions
|
||||
from src.pojo.ReserveResultPojo import ReserveResultPojo
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
|
||||
|
||||
def get_random_id_number() -> str:
|
||||
# write_the_valid_profiles_to_excel()
|
||||
S = 8 # number of characters in the string.
|
||||
# call random.choices() string module to find the string in Uppercase + numeric data.
|
||||
ran = ''.join(random.choices(string.digits, k=S))
|
||||
id_number = "57" + str(ran)
|
||||
print("The randomly generated string is : 94" + str(ran)) # print the random data
|
||||
return id_number
|
||||
|
||||
|
||||
def write_the_valid_profiles_to_excel():
|
||||
day_list = ['2022-06-02']
|
||||
|
||||
collection = []
|
||||
for day in day_list:
|
||||
collection.extend(definitions.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
|
||||
|
||||
print(contact)
|
||||
valid_contacts.append(contact)
|
||||
|
||||
row = 0
|
||||
col = 0
|
||||
# Create a workbook and add a worksheet.
|
||||
workbook = xlsxwriter.Workbook('valid_profile.xlsx')
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'ccid', 'position']
|
||||
worksheet = workbook.add_worksheet()
|
||||
header_format = workbook.add_format({'bold': True})
|
||||
|
||||
for col_num, data in enumerate(header_data):
|
||||
worksheet.write(row, col_num, data, header_format)
|
||||
row = row + 1
|
||||
for info in valid_contacts:
|
||||
# Iterate over the data and write it out row by row.
|
||||
worksheet.write(row, col, "{} {}".format(info.last_name, info.first_name))
|
||||
worksheet.write(row, col + 1, info.phone)
|
||||
worksheet.write(row, col + 2, info.passport)
|
||||
worksheet.write(row, col + 3, info.mail)
|
||||
worksheet.write(row, col + 4, info.ccid)
|
||||
row += 1
|
||||
workbook.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# get_random_id_number()
|
||||
write_the_valid_profiles_to_excel()
|
||||
Reference in New Issue
Block a user