Feat : Visual improvement and some useless data suppression for error report

This commit is contained in:
pierre.gauthier 2025-02-20 09:02:57 +01:00
parent f72c04ec2d
commit 8d8987ee15

View File

@ -203,39 +203,35 @@ def error_report(file_data,folder_data):
Crée le rapport d'utilisation du script
"""
#Couleur rouge
error_color =PatternFill(patternType='solid',fgColor='00FF0000')
error_color = PatternFill(patternType='solid',fgColor='00cb4335')
column_name_color = PatternFill(patternType='solid',fgColor='0085929e')
row_color = PatternFill(patternType='solid',fgColor='00ccd1d1')
report = xls.Workbook()
report_worsheet = report.active
report_worsheet.title = "Compte rendu"
report_worsheet['A1'] = "Fichiers trouvés"
report_worsheet['B1'] = "Occurences"
report_worsheet['F1'] = "Dossiers"
report_worsheet['G1'] = "Fichiers contenus"
report_worsheet['B1'] = "Dossiers"
report_worsheet['C1'] = "NB Fichiers"
report_worsheet['D1'] = "Rapport d'erreur"
report_worsheet.column_dimensions['A'].width *= 3
report_worsheet.column_dimensions['B'].width *= 3
report_worsheet.column_dimensions['F'].width *= 3
report_worsheet.column_dimensions['G'].width *= 3
report_worsheet.column_dimensions['H'].width *= 3
report_worsheet.column_dimensions['C'].width *= 3
report_worsheet.column_dimensions['D'].width *= 3
currrent_cell = 2
for key in file_data:
report_worsheet['A'+ str(currrent_cell)] = key
report_worsheet['B'+ str(currrent_cell)] = file_data.get(key)
currrent_cell+=1
report_worsheet['B1'].fill = report_worsheet['C1'].fill = report_worsheet['D1'].fill = column_name_color
currrent_cell = 2
for i, content in enumerate(folder_data):
report_worsheet['F'+ str(currrent_cell)] = FOLDERNAMES[i]
report_worsheet['G'+ str(currrent_cell)] = content
report_worsheet['B'+ str(currrent_cell)] = FOLDERNAMES[i]
report_worsheet['C'+ str(currrent_cell)] = content
if i % 2 == 0:
report_worsheet['B'+ str(currrent_cell)].fill = report_worsheet['C'+ str(currrent_cell)].fill = report_worsheet['D'+ str(currrent_cell)].fill = row_color
if content == 0:
report_worsheet['H'+ str(currrent_cell)] = "/!\\ aucun fichier dans le dossier /!\\"
report_worsheet['H'+ str(currrent_cell)].fill = error_color
report_worsheet['D'+ str(currrent_cell)] = "/!\\ aucun fichier dans le dossier /!\\"
report_worsheet['D'+ str(currrent_cell)].fill = error_color
currrent_cell+=1
report_worsheet['A'+str(3 + len(file_data.keys()))] = "Total fichiers"
report_worsheet['B'+str(3 + len(file_data.keys()))] = '=SUM(B2:B' + str(1 + len(file_data.keys())) + ')'
report.save("Rapport.xlsx")
def sortout():
@ -256,7 +252,6 @@ def sortout():
if confirm_choice("PLU" if answer == 1 else "PLUi"):
break
# On demande le numero INSEE ou SIREN tant que l'input est invalide
while True:
print("numero INSEE (Format 5 chiffres): "