This commit is contained in:
pro.boooooo 2023-03-31 02:54:11 +02:00
parent 294598a814
commit d79d09070c
4 changed files with 35 additions and 30 deletions

View File

@ -235,6 +235,8 @@ export default class View {
let modal = document.createElement("modal") let modal = document.createElement("modal")
window.scrollTo(0, 0);
const close = () => { const close = () => {
riot.unmount(modal, false) riot.unmount(modal, false)
this.left.style.filter = "none" this.left.style.filter = "none"
@ -250,7 +252,7 @@ export default class View {
type: type, type: type,
capacity: capacity, capacity: capacity,
wish: voeuxtotal, wish: voeuxtotal,
nhacad: Math.round(100 - admishorsacad), nhacad: Math.floor(100 - admishorsacad),
manPercent: man, manPercent: man,
womanPercent: woman, womanPercent: woman,
@ -339,13 +341,27 @@ export default class View {
}) })
let moyform = nbformation let moyform = nbformation
let moycap = Math.round(capacity / totcapacity) let moycap = Math.floor(capacity / totcapacity)
let moyselectivity = Math.round(selectivity / totselectivity) let moyselectivity = Math.floor(selectivity / totselectivity)
let sumOMoy = 0
data.forEach((e) => {
let sammoy = (e.fields.pct_sansmention * 11) / 20
let asbmoy = (e.fields.pct_ab * 13) / 20
let bimoy = (e.fields.pct_b * 15) / 20
let trbmoy = (e.fields.pct_tb * 17) / 20
let trbfmoy = (e.fields.pct_tbf * 19) / 20
sumOMoy += parseFloat(((sammoy + asbmoy + bimoy + trbmoy + trbfmoy) / 5).toFixed(1))
})
let moyad = parseFloat(sumOMoy / nbformation).toFixed(1)
return { return {
capacitycount: moycap, capacitycount: moycap,
nformcount: moyform, nformcount: moyform,
selectivitycount: moyselectivity selectivitycount: moyselectivity,
moyad: moyad
} }
} }
@ -364,8 +380,8 @@ export default class View {
}) })
let man = tot - woman let man = tot - woman
let moywomen = Math.round(100 * woman / tot) let moywomen = Math.floor(100 * woman / tot)
let moyman = Math.round(100 * man / tot) let moyman = Math.floor(100 * man / tot)
return { return {
man: `${moyman}%`, man: `${moyman}%`,
@ -392,10 +408,10 @@ export default class View {
}) })
let tot = gen + pro + tech + autre let tot = gen + pro + tech + autre
let moygen = Math.round(100 * gen / tot) let moygen = Math.floor(100 * gen / tot)
let moytech = Math.round(100 * tech / tot) let moytech = Math.floor(100 * tech / tot)
let moypro = Math.round(100 * pro / tot) let moypro = Math.floor(100 * pro / tot)
let moyautre = Math.round(100 * autre / tot) let moyautre = Math.floor(100 * autre / tot)
return { return {
gen: `${moygen}%`, gen: `${moygen}%`,
@ -426,11 +442,11 @@ export default class View {
}) })
let tot = p + ab + b + tb + tbf let tot = p + ab + b + tb + tbf
let moyp = Math.round(100 * p / tot) let moyp = Math.floor(100 * p / tot)
let moyab = Math.round(100 * ab / tot) let moyab = Math.floor(100 * ab / tot)
let moyb = Math.round(100 * b / tot) let moyb = Math.floor(100 * b / tot)
let moytb = Math.round(100 * tb / tot) let moytb = Math.floor(100 * tb / tot)
let moytbf = Math.round(100 * tbf / tot) let moytbf = Math.floor(100 * tbf / tot)
return { return {
p: `${moyp}%`, p: `${moyp}%`,
@ -448,6 +464,7 @@ export default class View {
if(data.length > 0) { if(data.length > 0) {
riot.mount(elem, { riot.mount(elem, {
moyad: gen.moyad,
capacitycount: gen.capacitycount, capacitycount: gen.capacitycount,
nformcount: gen.nformcount, nformcount: gen.nformcount,
selectivitycount: gen.selectivitycount, selectivitycount: gen.selectivitycount,

View File

@ -273,7 +273,7 @@
<div id="generalysticsfragment-gen"> <div id="generalysticsfragment-gen">
<div class="generalysticsfragment-gen-component"> <div class="generalysticsfragment-gen-component">
<span class="generalysticsfragment-gen-text">Moyenne des admis</span> <span class="generalysticsfragment-gen-text">Moyenne des admis</span>
<span class="generalysticsfragment-gen-text">?</span> <span class="generalysticsfragment-gen-text">{ this.props.moyad }</span>
</div> </div>
<div class="generalysticsfragment-gen-component"> <div class="generalysticsfragment-gen-component">

View File

@ -4,13 +4,12 @@
position: absolute; position: absolute;
margin: auto; margin: auto;
top: 0; top: 0;
bottom: 0;
right: 0; right: 0;
left: 0; left: 0;
background: #7A90A4; background: #7A90A4;
box-shadow: 0px 0px 9px 1px black; box-shadow: 0px 0px 9px 1px black;
width: 85%; width: 85%;
height: 85%; height: 55%;
border-radius: 14px; border-radius: 14px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -18,17 +18,6 @@
} }
</style> </style>
<app id="root"></app> <div id="root"></div>
<script src="https://cdn.jsdelivr.net/npm/riot@latest/riot+compiler.min.js"></script>
<script src="https://unpkg.com/riot@latest/dist/riot.min.js"></script>
<script src="https://unpkg.com/riot@latest/dist/riot+compiler.min.js"></script>
<script src="https://unpkg.com/babel-polyfill@7.12.1/dist/polyfill.min.js"></script>
<script src="https://unpkg.com/@riotjs/hydrate@latest/dist/hydrate.min.js"></script>
<script src="https://unpkg.com/axios@latest/dist/axios.min.js"></script>
<script src="https://unpkg.com/lodash@latest/lodash.min.js"></script>
<script src="pages.js"></script>
<script src="register-global-components.js"></script>
<script src="index.js"></script>
</body> </body>
</html> </html>