From 6009fffe4c7cc183d4bc877029c93102cfa6594c Mon Sep 17 00:00:00 2001
From: Charles <70532837+cAptive5976@users.noreply.github.com>
Date: Sun, 31 Dec 2023 23:38:08 +0100
Subject: [PATCH] =?UTF-8?q?Correction=20du=20bug=20#19=20ainsi=20que=20des?=
=?UTF-8?q?=20probl=C3=A8mes=20d'encodage=20UTF-8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Pour la version 1.0.0-beta.2
- Correction du bug des cases vide #19
- Correction mauvais encodage pour les caractères UTF-8
- Ajout d'un arondissement des valeurs moyennes
Pour la version 1.0.0-beta.2
- Correction du bug des cases vide #19
- Correction mauvais encodage pour les caractères UTF-8
- Ajout d'un arondissement des valeurs moyennes
Pour la version 1.0.0-beta.2
- Correction du bug des cases vides 19
- Correction mauvais encodage pour les caractères UTF-8
- Ajout d'un arrondissement des valeurs moyennes
---
html/index.html | 144 ++++++++++++++------------------
occupation/module_occupation.py | 18 ++--
2 files changed, 75 insertions(+), 87 deletions(-)
diff --git a/html/index.html b/html/index.html
index 4ec9a53..cf24bf8 100644
--- a/html/index.html
+++ b/html/index.html
@@ -1,9 +1,11 @@
-
+
+
+
I-calendar : occupation des salles
-
+
@@ -14,185 +16,169 @@ I-calendar : occupation des salles
Salle
Heures d'utlisation
- Heures d'utilisation moyen/semaine
- Heures d'utilisation moyen/jour
- Taux d'occupation (%)
+ Heures d’utilisation moyen/semaine
+ Heures d’utilisation moyen/jour
+ Taux d’occupation (%)
A200 [I01]
83.5
- 11.928571428571429
- 0.0412142152023692
- 4.12142152023692%
+ 11.93
+ 0.04
+ 4.12%
RT-Projet [I04]
362.5
- 51.785714285714285
- 0.17892398815399801
- 17.8923988153998%
+ 51.79
+ 0.18
+ 17.89%
RT12 [I04]
172.5
- 24.642857142857142
- 0.0851431391905232
- 8.51431391905232%
+ 24.64
+ 0.09
+ 8.51%
RT05 [I04]
396.0
- 56.57142857142857
- 0.19545903257650543
- 19.545903257650544%
+ 56.57
+ 0.2
+ 19.55%
RT13 [I04]
362.0
- 51.714285714285715
- 0.17867719644619942
- 17.867719644619942%
+ 51.71
+ 0.18
+ 17.87%
RT-I-01 [I04]
537.0
- 76.71428571428571
- 0.2650542941757157
- 26.50542941757157%
+ 76.71
+ 0.27
+ 26.51%
RT04 [I04]
454.0
- 64.85714285714286
- 0.2240868706811451
- 22.40868706811451%
+ 64.86
+ 0.22
+ 22.41%
RT-I-02 [I04]
176.5
- 25.214285714285715
- 0.08711747285291215
- 8.711747285291214%
+ 25.21
+ 0.09
+ 8.71%
RT14 [I04]
674.0
- 96.28571428571429
- 0.33267522211253703
- 33.267522211253706%
-
-
-
-
- 42.5
- 6.071428571428571
- 0.020977295162882527
- 2.0977295162882528%
+ 96.29
+ 0.33
+ 33.27%
RT03 [I04]
331.0
- 47.285714285714285
- 0.16337611056268508
- 16.337611056268507%
+ 47.29
+ 0.16
+ 16.34%
RT16 [I04]
240.0
- 34.285714285714285
- 0.11846001974333663
- 11.846001974333662%
+ 34.29
+ 0.12
+ 11.85%
RT26 [I04]
170.5
- 24.357142857142858
- 0.08415597235932873
- 8.415597235932873%
+ 24.36
+ 0.08
+ 8.42%
MP-I-20 [I03]
45.0
- 6.428571428571429
- 0.022211253701875617
- 2.2211253701875617%
+ 6.43
+ 0.02
+ 2.22%
RT-Réunion [I04]
4.0
- 0.5714285714285714
- 0.0019743336623889436
- 0.19743336623889435%
+ 0.57
+ 0.0
+ 0.2%
RT15 [I04]
128.0
- 18.285714285714285
- 0.0631786771964462
- 6.317867719644619%
+ 18.29
+ 0.06
+ 6.32%
RT15 [I04]\,RT14 [I04]\,RT-I-01 [I04]
12.0
- 1.7142857142857142
- 0.005923000987166831
- 0.5923000987166831%
+ 1.71
+ 0.01
+ 0.59%
RT28 [I04]
203.0
29.0
- 0.10019743336623889
- 10.01974333662389%
+ 0.1
+ 10.02%
RT-I-02 [I04]\,RT15 [I04]\,RT14 [I04]
3.0
- 0.42857142857142855
- 0.0014807502467917078
- 0.14807502467917077%
+ 0.43
+ 0.0
+ 0.15%
RT03 [I04]\,RT-Projet [I04]
7.0
1.0
- 0.0034550839091806516
- 0.3455083909180652%
-
-
-
- salle-non-renseignée-IUT86-Chatel
- 1.5
- 0.21428571428571427
- 0.0007403751233958539
- 0.07403751233958539%
+ 0.0
+ 0.35%
TC-A [I05]
1.5
- 0.21428571428571427
- 0.0007403751233958539
- 0.07403751233958539%
+ 0.21
+ 0.0
+ 0.07%
diff --git a/occupation/module_occupation.py b/occupation/module_occupation.py
index 21fdc70..c6fe487 100644
--- a/occupation/module_occupation.py
+++ b/occupation/module_occupation.py
@@ -10,7 +10,7 @@ def extract_data(file_list):
"""
data = []
for file_path in file_list:
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
data.append(file.read())
return data
@@ -56,8 +56,10 @@ def generate_html(data, output_dir):
:type output_dir: str
"""
html_content = """
-
+
+
+
I-calendar : occupation des salles
@@ -80,17 +82,17 @@ def generate_html(data, output_dir):
processed_locations = set()
for event in data:
location = event['location']
- if location in processed_locations:
- continue
+ if location in processed_locations or location == '' or location == 'salle-non-renseignée-IUT86-Chatel':
+ continue
total_hours = sum((event['end_time'] - event['start_time']).total_seconds() / 3600 for event in data if event['location'] == location)
processed_locations.add(location)
html_content += f"""
{location}
{total_hours}
- {total_hours / 7 }
- {total_hours / len(data)}
- {total_hours / len(data) * 100}%
+ {round(total_hours / 7, 2)}
+ {round(total_hours / len(data), 2)}
+ {round((total_hours / len(data)) * 100, 2)}%
"""
@@ -105,5 +107,5 @@ def generate_html(data, output_dir):
"""
- with open(output_dir + 'index.html', 'w') as file:
+ with open(output_dir + 'index.html', 'w', encoding='utf-8') as file:
file.write(html_content)