diff --git a/src/components/global/api/View.js b/src/components/global/api/View.js index eeaecf8..f905e51 100644 --- a/src/components/global/api/View.js +++ b/src/components/global/api/View.js @@ -235,6 +235,8 @@ export default class View { let modal = document.createElement("modal") + window.scrollTo(0, 0); + const close = () => { riot.unmount(modal, false) this.left.style.filter = "none" @@ -250,7 +252,7 @@ export default class View { type: type, capacity: capacity, wish: voeuxtotal, - nhacad: Math.round(100 - admishorsacad), + nhacad: Math.floor(100 - admishorsacad), manPercent: man, womanPercent: woman, @@ -339,13 +341,27 @@ export default class View { }) let moyform = nbformation - let moycap = Math.round(capacity / totcapacity) - let moyselectivity = Math.round(selectivity / totselectivity) + let moycap = Math.floor(capacity / totcapacity) + 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 { capacitycount: moycap, nformcount: moyform, - selectivitycount: moyselectivity + selectivitycount: moyselectivity, + moyad: moyad } } @@ -364,8 +380,8 @@ export default class View { }) let man = tot - woman - let moywomen = Math.round(100 * woman / tot) - let moyman = Math.round(100 * man / tot) + let moywomen = Math.floor(100 * woman / tot) + let moyman = Math.floor(100 * man / tot) return { man: `${moyman}%`, @@ -392,10 +408,10 @@ export default class View { }) let tot = gen + pro + tech + autre - let moygen = Math.round(100 * gen / tot) - let moytech = Math.round(100 * tech / tot) - let moypro = Math.round(100 * pro / tot) - let moyautre = Math.round(100 * autre / tot) + let moygen = Math.floor(100 * gen / tot) + let moytech = Math.floor(100 * tech / tot) + let moypro = Math.floor(100 * pro / tot) + let moyautre = Math.floor(100 * autre / tot) return { gen: `${moygen}%`, @@ -426,11 +442,11 @@ export default class View { }) let tot = p + ab + b + tb + tbf - let moyp = Math.round(100 * p / tot) - let moyab = Math.round(100 * ab / tot) - let moyb = Math.round(100 * b / tot) - let moytb = Math.round(100 * tb / tot) - let moytbf = Math.round(100 * tbf / tot) + let moyp = Math.floor(100 * p / tot) + let moyab = Math.floor(100 * ab / tot) + let moyb = Math.floor(100 * b / tot) + let moytb = Math.floor(100 * tb / tot) + let moytbf = Math.floor(100 * tbf / tot) return { p: `${moyp}%`, @@ -448,6 +464,7 @@ export default class View { if(data.length > 0) { riot.mount(elem, { + moyad: gen.moyad, capacitycount: gen.capacitycount, nformcount: gen.nformcount, selectivitycount: gen.selectivitycount, diff --git a/src/components/global/generalytics/generalysticsfragment.riot b/src/components/global/generalytics/generalysticsfragment.riot index b308991..e3d9929 100644 --- a/src/components/global/generalytics/generalysticsfragment.riot +++ b/src/components/global/generalytics/generalysticsfragment.riot @@ -273,7 +273,7 @@