Skip to content

Commit

Permalink
Correction du bug #19 ainsi que des problèmes d'encodage UTF-8
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cAptive5976 committed Dec 31, 2023
1 parent 71ebaf9 commit 6009fff
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 87 deletions.
144 changes: 65 additions & 79 deletions html/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

<html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>I-calendar : occupation des salles</title>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="icon" type="img/png" href="img/icon.png" />
<link rel="icon" type="img/png" href="images/icon.png" />
</head>
<body>
<header>
Expand All @@ -14,185 +16,169 @@ <h2>I-calendar : occupation des salles</h2>
<tr>
<th>Salle</th>
<th>Heures d'utlisation</th>
<th>Heures d'utilisation moyen/semaine</th>
<th>Heures d'utilisation moyen/jour</th>
<th>Taux d'occupation (%)</th>
<th>Heures dutilisation moyen/semaine</th>
<th>Heures dutilisation moyen/jour</th>
<th>Taux doccupation (%)</th>
</tr>

<tr>
<td>A200 [I01]</td>
<td>83.5</td>
<td>11.928571428571429</td>
<td>0.0412142152023692</td>
<td>4.12142152023692%</td>
<td>11.93</td>
<td>0.04</td>
<td>4.12%</td>
</tr>

<tr>
<td>RT-Projet [I04]</td>
<td>362.5</td>
<td>51.785714285714285</td>
<td>0.17892398815399801</td>
<td>17.8923988153998%</td>
<td>51.79</td>
<td>0.18</td>
<td>17.89%</td>
</tr>

<tr>
<td>RT12 [I04]</td>
<td>172.5</td>
<td>24.642857142857142</td>
<td>0.0851431391905232</td>
<td>8.51431391905232%</td>
<td>24.64</td>
<td>0.09</td>
<td>8.51%</td>
</tr>

<tr>
<td>RT05 [I04]</td>
<td>396.0</td>
<td>56.57142857142857</td>
<td>0.19545903257650543</td>
<td>19.545903257650544%</td>
<td>56.57</td>
<td>0.2</td>
<td>19.55%</td>
</tr>

<tr>
<td>RT13 [I04]</td>
<td>362.0</td>
<td>51.714285714285715</td>
<td>0.17867719644619942</td>
<td>17.867719644619942%</td>
<td>51.71</td>
<td>0.18</td>
<td>17.87%</td>
</tr>

<tr>
<td>RT-I-01 [I04]</td>
<td>537.0</td>
<td>76.71428571428571</td>
<td>0.2650542941757157</td>
<td>26.50542941757157%</td>
<td>76.71</td>
<td>0.27</td>
<td>26.51%</td>
</tr>

<tr>
<td>RT04 [I04]</td>
<td>454.0</td>
<td>64.85714285714286</td>
<td>0.2240868706811451</td>
<td>22.40868706811451%</td>
<td>64.86</td>
<td>0.22</td>
<td>22.41%</td>
</tr>

<tr>
<td>RT-I-02 [I04]</td>
<td>176.5</td>
<td>25.214285714285715</td>
<td>0.08711747285291215</td>
<td>8.711747285291214%</td>
<td>25.21</td>
<td>0.09</td>
<td>8.71%</td>
</tr>

<tr>
<td>RT14 [I04]</td>
<td>674.0</td>
<td>96.28571428571429</td>
<td>0.33267522211253703</td>
<td>33.267522211253706%</td>
</tr>

<tr>
<td></td>
<td>42.5</td>
<td>6.071428571428571</td>
<td>0.020977295162882527</td>
<td>2.0977295162882528%</td>
<td>96.29</td>
<td>0.33</td>
<td>33.27%</td>
</tr>

<tr>
<td>RT03 [I04]</td>
<td>331.0</td>
<td>47.285714285714285</td>
<td>0.16337611056268508</td>
<td>16.337611056268507%</td>
<td>47.29</td>
<td>0.16</td>
<td>16.34%</td>
</tr>

<tr>
<td>RT16 [I04]</td>
<td>240.0</td>
<td>34.285714285714285</td>
<td>0.11846001974333663</td>
<td>11.846001974333662%</td>
<td>34.29</td>
<td>0.12</td>
<td>11.85%</td>
</tr>

<tr>
<td>RT26 [I04]</td>
<td>170.5</td>
<td>24.357142857142858</td>
<td>0.08415597235932873</td>
<td>8.415597235932873%</td>
<td>24.36</td>
<td>0.08</td>
<td>8.42%</td>
</tr>

<tr>
<td>MP-I-20 [I03]</td>
<td>45.0</td>
<td>6.428571428571429</td>
<td>0.022211253701875617</td>
<td>2.2211253701875617%</td>
<td>6.43</td>
<td>0.02</td>
<td>2.22%</td>
</tr>

<tr>
<td>RT-Réunion [I04]</td>
<td>4.0</td>
<td>0.5714285714285714</td>
<td>0.0019743336623889436</td>
<td>0.19743336623889435%</td>
<td>0.57</td>
<td>0.0</td>
<td>0.2%</td>
</tr>

<tr>
<td>RT15 [I04]</td>
<td>128.0</td>
<td>18.285714285714285</td>
<td>0.0631786771964462</td>
<td>6.317867719644619%</td>
<td>18.29</td>
<td>0.06</td>
<td>6.32%</td>
</tr>

<tr>
<td>RT15 [I04]\,RT14 [I04]\,RT-I-01 [I04]</td>
<td>12.0</td>
<td>1.7142857142857142</td>
<td>0.005923000987166831</td>
<td>0.5923000987166831%</td>
<td>1.71</td>
<td>0.01</td>
<td>0.59%</td>
</tr>

<tr>
<td>RT28 [I04]</td>
<td>203.0</td>
<td>29.0</td>
<td>0.10019743336623889</td>
<td>10.01974333662389%</td>
<td>0.1</td>
<td>10.02%</td>
</tr>

<tr>
<td>RT-I-02 [I04]\,RT15 [I04]\,RT14 [I04]</td>
<td>3.0</td>
<td>0.42857142857142855</td>
<td>0.0014807502467917078</td>
<td>0.14807502467917077%</td>
<td>0.43</td>
<td>0.0</td>
<td>0.15%</td>
</tr>

<tr>
<td>RT03 [I04]\,RT-Projet [I04]</td>
<td>7.0</td>
<td>1.0</td>
<td>0.0034550839091806516</td>
<td>0.3455083909180652%</td>
</tr>

<tr>
<td>salle-non-renseignée-IUT86-Chatel</td>
<td>1.5</td>
<td>0.21428571428571427</td>
<td>0.0007403751233958539</td>
<td>0.07403751233958539%</td>
<td>0.0</td>
<td>0.35%</td>
</tr>

<tr>
<td>TC-A [I05]</td>
<td>1.5</td>
<td>0.21428571428571427</td>
<td>0.0007403751233958539</td>
<td>0.07403751233958539%</td>
<td>0.21</td>
<td>0.0</td>
<td>0.07%</td>
</tr>

</table>
Expand Down
18 changes: 10 additions & 8 deletions occupation/module_occupation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -56,8 +56,10 @@ def generate_html(data, output_dir):
:type output_dir: str
"""
html_content = """
<html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>I-calendar : occupation des salles</title>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="icon" type="img/png" href="images/icon.png" />
Expand All @@ -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"""
<tr>
<td>{location}</td>
<td>{total_hours}</td>
<td>{total_hours / 7 }</td>
<td>{total_hours / len(data)}</td>
<td>{total_hours / len(data) * 100}%</td>
<td>{round(total_hours / 7, 2)}</td>
<td>{round(total_hours / len(data), 2)}</td>
<td>{round((total_hours / len(data)) * 100, 2)}%</td>
</tr>
"""

Expand All @@ -105,5 +107,5 @@ def generate_html(data, output_dir):
</html>
"""

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)

0 comments on commit 6009fff

Please sign in to comment.