update contact list

This commit is contained in:
2022-03-02 10:38:40 +01:00
parent 4563929881
commit 4333aa5977
4 changed files with 19 additions and 9 deletions
BIN
View File
Binary file not shown.
+13 -7
View File
@@ -52,17 +52,23 @@ class DataManager:
if __name__ == '__main__': if __name__ == '__main__':
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('sim_infos.xlsx')
worksheet = workbook.add_worksheet()
# Start from the first cell. Rows and columns are zero indexed. # Start from the first cell. Rows and columns are zero indexed.
row = 0 sim_info_list = []
col = 0
for sim in params.firebase_store_manager.get_all_sim_infos().stream(): for sim in params.firebase_store_manager.get_all_sim_infos().stream():
print(sim) print(sim)
sim_pojo = SimInfoPojo.from_firestore_dict(sim.to_dict()) sim_pojo = SimInfoPojo.from_firestore_dict(sim.to_dict())
sim_info_list.append(sim_pojo)
row = 0
col = 0
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('sim_infos.xlsx')
worksheet = workbook.add_worksheet()
for info in sim_info_list:
# Iterate over the data and write it out row by row. # Iterate over the data and write it out row by row.
worksheet.write(row, col, sim_pojo.phone[2:len(sim_pojo.phone)]) worksheet.write(row, col, info.phone[2:len(info.phone)])
worksheet.write(row, col + 1, sim_pojo.ccid) worksheet.write(row, col + 1, info.ccid)
worksheet.write(row, col + 2, info.position)
row += 1 row += 1
workbook.close() workbook.close()
BIN
View File
Binary file not shown.
+6 -2
View File
@@ -18,8 +18,12 @@ class SimInfoPojo:
def from_firestore_dict(source): def from_firestore_dict(source):
phone = source['phone'] phone = source['phone']
ccid = source['ccid'] ccid = source['ccid']
update_at = source['update_at'] update_at = None
position = source['position'] if 'update_at' in source:
update_at = source['update_at']
position = None
if 'position' in source:
position = source['position']
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position) result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position)
result.id = id result.id = id
return result return result