Skip to content

Commit

Permalink
feat(contents): add some stats on the presence
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Aug 22, 2023
1 parent f65d4a8 commit 5f2f86b
Show file tree
Hide file tree
Showing 45 changed files with 425 additions and 1 deletion.
19 changes: 19 additions & 0 deletions bin/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ async function run() {
writterData.presences[file.replace(/\.csv$/, "")] =
presences.sort(sortByDate);

writterData.presencesStats = writterData.presencesStats || {};
writterData.presencesStats[file.replace(/\.csv$/, "")] = presences.reduce(
(stats, presence) => ({
total: stats.total + 1,
present: stats.present + (presence.present ? 1 : 0),
arrivedLate: stats.arrivedLate + (presence.arrivedLate ? 1 : 0),
leftBeforeTheEnd:
stats.leftBeforeTheEnd + (presence.leftBeforeTheEnd ? 1 : 0),
delegation: stats.delegation + (presence.delegation ? 1 : 0),
}),
{
total: 0,
present: 0,
arrivedLate: 0,
leftBeforeTheEnd: 0,
delegation: 0,
}
);

await writeFile(
pathJoin("contents", "writters", `${persons[personId].id}.json`),
JSON.stringify(writterData, null, 2)
Expand Down
9 changes: 9 additions & 0 deletions contents/writters/agnes-dupuis.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,5 +467,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 22,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 0
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/anissa-bouchaboun.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,5 +453,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 15,
"arrivedLate": 2,
"leftBeforeTheEnd": 0,
"delegation": 7
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/anne-colin.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,5 +521,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 20,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 2
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/anne-sophie-audegond.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,5 +451,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 14,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 7
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/auriane-ait-lasri.json
Original file line number Diff line number Diff line change
Expand Up @@ -1196,5 +1196,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 18,
"arrivedLate": 1,
"leftBeforeTheEnd": 0,
"delegation": 4
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/avida-oulahcene.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,5 +447,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 15,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 6
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/carolle-divrechy.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,5 +499,14 @@
}
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 14,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 8
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/chantal-rybak.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,14 @@
}
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 19,
"arrivedLate": 1,
"leftBeforeTheEnd": 0,
"delegation": 3
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/coline-craeye.json
Original file line number Diff line number Diff line change
Expand Up @@ -1219,5 +1219,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 22,
"arrivedLate": 1,
"leftBeforeTheEnd": 0,
"delegation": 0
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/eric-lemaitre.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,5 +447,14 @@
}
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 15,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 6
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/francois-guiffard.json
Original file line number Diff line number Diff line change
Expand Up @@ -1621,5 +1621,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 15,
"arrivedLate": 1,
"leftBeforeTheEnd": 0,
"delegation": 1
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/franz-quatreboeufs.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,5 +814,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 22,
"arrivedLate": 2,
"leftBeforeTheEnd": 0,
"delegation": 0
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/frederic-chereau.json
Original file line number Diff line number Diff line change
Expand Up @@ -4090,5 +4090,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 22,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 0
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/guy-cannie.json
Original file line number Diff line number Diff line change
Expand Up @@ -2484,5 +2484,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 18,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 3
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/guy-caruyer.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,5 +510,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 22,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 0
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/guy-lagache.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,5 +450,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 15,
"present": 13,
"arrivedLate": 1,
"leftBeforeTheEnd": 0,
"delegation": 2
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/hocine-mazy.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,5 +479,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 19,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 3
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/jamila-mekki.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,5 +475,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 18,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 2
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/jean-christophe-leclercq.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,5 +561,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 21,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 1
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/jean-marie-dupire.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,5 +455,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 12,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 8
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/jean-michel-leroy.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,5 +479,14 @@
}
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 19,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 3
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/jessy-kaboul.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,5 +411,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 7,
"present": 6,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 1
}
}
}
9 changes: 9 additions & 0 deletions contents/writters/katia-bittner.json
Original file line number Diff line number Diff line change
Expand Up @@ -634,5 +634,14 @@
"present": true
}
]
},
"presencesStats": {
"cm-douai": {
"total": 22,
"present": 21,
"arrivedLate": 0,
"leftBeforeTheEnd": 0,
"delegation": 1
}
}
}
Loading

0 comments on commit 5f2f86b

Please sign in to comment.