1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
| var detail_moy_th = "Détail du calcul de la moyenne théorique : ";
function calculs(tableau_cotes_th,tableau_cotes_tp,martricule)
{
//tableau qui contient la valeur des pondérations de BA3
var tableau_pond_BA3_th = new Array(4,3,1.5,3.5,4,4,4);
var tableau_pond_BA3_tp = new Array(1,1,1,1,1,1,1,1);
var i=0;
// fusion des deux tableaux (th et tp) afin que quand une formule est appliquée sur la th et les tp, je ne doive pas écrire le code deux fois.
//ATTNETION : le concact transforme les entiers en string, ce qui peux poser des problemes pour les calculs
var tableau_cours_th_tp = tableau_cotes_th.concat(tableau_cotes_tp);
var tableau_cours_th_tp_int = new Array();
//je dois donc parser les lettes ("3","4"... en entier) c'est a dire transformer mon tableau de string en tableau d'entier
//je ne fait que transformer le tableau de string en un tableau d'entier.
for(i;i<tableau_cours_th_tp.length;i++)
{
tableau_cours_th_tp_int[i] = parseInt(tableau_cours_th_tp[i]);
}
//alert("voici le tableau transformé ==> " + tableau_cours_th_tp_int);
//alert("le type de ce nouveau tableau est " + typeof(tableau_cours_th_tp_int[2]));
//alert(tableau_cours_th_tp_int.length);
//alert(tableau_cours_th_tp);
//=SOMMEPROD($D$7:$J$7;D10:J10) Je multiplie la pondération et sa cote, le total sera additionné avec les autres résultats (cote * pondération)
//SOMMEPROD ==> Somme des produits !!!!
i = 0;
var total_th = 0;
detail_sommeprodth = "Détail du sommeprod (TH) : ";
for(i;i<tableau_pond_BA3_th.length;i++)
{
//alert(typeof(tableau_pond_BA3_th[i]));
//=SOMMEPROD($D$7:$J$7;D10:J10)
total_th = total_th + (tableau_pond_BA3_th[i] * tableau_cotes_th[i]);
//détails du sommeprod th
detail_sommeprodth = detail_sommeprodth + "(" + tableau_pond_BA3_th[i] + " * " + tableau_cotes_th[i] + ") ";
if(i!=(tableau_pond_BA3_th.length - 1))
{
detail_sommeprodth = detail_sommeprodth + "+";
}
else
{
detail_sommeprodth = detail_sommeprodth + "= " + total_th;
}
}
//alert(detail_sommeprodth);
//alert("total_th : " + total_th);
//nombre de dispense
nbDispense = 0;
i=0;
var detail_nombreDeDispense = "";
for(i;i<tableau_cours_th_tp.length;i++)
{
if((tableau_cours_th_tp[i] == "d") || (tableau_cours_th_tp[i] == "D"))
{
nbDispense++;
}
}
//détail nombre de dispenses
detail_nombreDeDispense = "le nombre de dispense dans les cotes est de " + nbDispense;
//alert(detail_nombreDeDispense);
//alert("total_th : "+total_th);
//=SOMMEPROD($K$7:$R$7;K10:R10)
var total_tp =0;
i = 0;
detail_sommeprodtp = "";
for(i;i<tableau_pond_BA3_tp.length;i++)
{
total_tp = total_tp + ( tableau_pond_BA3_tp[i] * tableau_cotes_tp[i] );
//détail du calcul de pondération TP
detail_sommeprodtp = detail_sommeprodtp + "(" + tableau_pond_BA3_tp[i] + " * " + tableau_cotes_tp[i] + ") ";
if(i!=(tableau_pond_BA3_tp.length - 1))
{
detail_sommeprodtp = detail_sommeprodtp + "+";
}
else
{
detail_sommeprodtp = detail_sommeprodtp + "= " + total_tp;
}
}
//alert(detail_sommeprodtp);
//alert("total_tp "+total_tp);
//=SOMME.SI(D10:J10;">0";$D$7:$J$7) Si la cote est supérieure a 0, j'additionne la pondération de la cote
// TH
var total_pond_th = 0;
i=0;
detail_total_pond_th = "";
for(i;i<tableau_pond_BA3_th.length;i++)
{
if(tableau_cotes_th[i] > 0)
{
total_pond_th = total_pond_th + tableau_pond_BA3_th[i];
detail_total_pond_th = detail_total_pond_th + tableau_pond_BA3_th[i];
if(i!=(tableau_pond_BA3_th.length - 1))
{
detail_total_pond_th = detail_total_pond_th + "+";
}
else
{
detail_total_pond_th = detail_total_pond_th + "= " + total_pond_th;
}
}
}
//alert(detail_total_pond_th);
//alert("total_pond_th "+total_pond_th);
//TP
var total_pond_tp = 0;
i=0;
detail_total_pond_tp = "Total des pondérations TP pour lequel les cotes sont supérieures a zéro : ";
for(i;i<tableau_pond_BA3_tp.length;i++)
{
if(tableau_cotes_tp[i] > 0)
{
total_pond_tp = total_pond_tp + tableau_pond_BA3_tp[i];
//détail du total de pondération tp pour les cotes supérieures a 0.
detail_total_pond_tp = detail_total_pond_tp + tableau_pond_BA3_tp[i];
if(i!=(tableau_pond_BA3_tp.length - 1))
{
detail_total_pond_tp = detail_total_pond_tp + "+";
}
else
{
detail_total_pond_tp = detail_total_pond_tp + "= " + total_pond_tp;
}
}
}
//alert(detail_total_pond_tp);
//alert("total_pond_tp "+total_pond_tp);
//=SI(T10=0;"ABS";U10/T10) si toutes les cotes sont égales a 0 => le total des pondérations vaudra 0 => ABS autrement on divise les totaux des produits des cotes et de sa pondération par le nombre des pondération de l'étudiant, on obtient alors la moyenne théorique
//µ TH
var moy_th = 0;
//alert("total_pond_th : "+total_pond_th);
if(total_pond_th > 0)
{
moy_th = total_th/total_pond_th;
//détail du calcul de la moyenne théorique
detail_moy_th = detail_moy_th + total_th + " /" + total_pond_th + " = " + moy_th;
//alert("moy_th : "+moy_th);
}
else
{
moy_th = "ABS";
}
alert(detail_moy_th);
//µ TP
var moy_tp = 0;
detail_moy_tp = "Détail du calcul de la moyenne pratique : ";
//alert("total_pond_th : "+total_pond_th);
if(total_pond_tp > 0)
{
//alert("total_tp : " + total_tp);
//alert("total_pond_tp : " + total_pond_tp);
moy_tp = total_tp/total_pond_tp;
//détail du calcul de la moyenne pratique
detail_moy_tp = detail_moy_tp + total_tp + " /" + total_pond_tp + " = " + moy_tp;
//alert("moy_tp : "+moy_tp);
}
else
{
moy_tp = "ABS";
}
//alert(detail_moy_tp);
//alert("moyenne théorique " + moy_th);
//=SI(OU(NB.SI(D10:R10;"abs")>0;NB.SI(D10:R10;"j")>0;(T10+V10)=0);0;(U10+W10)/(T10+V10)) Si on retrouve "ABS" ou "J" dans les cotes de l'étudiant, donc si ABS ou j apparait plus de zéro fois, a ce moment la, ABS dans la moyenne générale ou que le total des pondérations TH et TP fait 0 alors la cellule vaudra 0
//SI aucun de ces criteres, on additionne le total des ponderations\cours TH au total des pondérations\cours TP que l'on divise par le total des pondérations th + tp
var moy_gen = 0;
var moy_gen_ok = true;
detail_moy_gen = "Détail du calcul de la moyenne générale : ";
var nb_abs_j = 0; //le nombre d'ABS et de J dans une meme ligne ==> sert pour ==> =NB.SI(D10:R10;"ABS")+NB.SI(D10:R10;"j")
i = 0;
for(i;i<tableau_cours_th_tp.length;i++)
{
if( (tableau_cours_th_tp[i] == "ABS") || (tableau_cours_th_tp[i] == "j") )
{
var moy_gen_ok = false;
nb_abs_j++;
}
}
//alert("nb_abs_j : "+nb_abs_j);
//(moy_gen_ok == true)?alert("moyenne générale ok"):alert("pas ok");
//suite de =SI(OU(NB.SI(D10:R10;"abs")>0;NB.SI(D10:R10;"j")>0;(T10+V10)=0);0;(U10+W10)/(T10+V10))
if(moy_gen_ok)
{
moy_gen = (total_th+total_tp)/(total_pond_th + total_pond_tp);
//détail du calcul de la moyenne générale
detail_moy_gen = "(" + total_th + " + " + total_tp + ") / (" + total_pond_th + " + " + total_pond_tp + ") = " + moy_gen;
}
//alert(detail_moy_gen);
//alert(moy_gen);
//=V10+T10
var total_pond_th_tp = total_pond_th + total_pond_tp;
//=U10+W10
var somme_prod_th_tp = total_th + total_tp;
//alert("total_pond_th_tp : "+total_pond_th_tp);
//alert("somme_prod_th_tp : "+somme_prod_th_tp);
//=SI(OU((AB10*(1-AJ10)<AA10*11,5);AH10>2;AA10=0);"Aj";SI((NBCAR(AC10)+NBCAR(AD10)+NBCAR(AE10))>0;"";SI(AB10<AA10*12;"Aj ? : -"&CTXT(AA10*12-AB10;0);" S ")))
// if(somme_prod_th_tp*(1-0) < (total_pond_th_tp * 17,5))
//=NB.SI(D10:R10;9)+NB.SI(D10:R10;8)*2+NB.SI(D10:R10;"<8")*3
var points_bal = 0;
var detail_points_bal = "Detail des points de balances : ";
i=0;
for(i;i<tableau_cours_th_tp.length;i++)
{
if(tableau_cours_th_tp[i]==9)
{
//alert("tableau_cotes_th[i] : "+ tableau_cotes_th[i]);
//alert("points_bal vaut " + points_bal);
points_bal++;
//détail des balances pour les cotes strictement égales a 9 :
detail_points_bal = detail_points_bal + "1 (cote == 9)";
if(i!=(tableau_cours_th_tp.length - 1))
{
detail_points_bal = detail_points_bal + " + ";
}
else
{
detail_points_bal = detail_points_bal + "= " + points_bal;
}
}
else if(tableau_cours_th_tp[i]==8)
{
//alert(tableau_cotes_th[i]);
//alert("points_bal vaut " + points_bal);
points_bal=points_bal+2;
//détail des balances pour les cotes strictement égales a 8 :
detail_points_bal = detail_points_bal + "2 (cote == 8)";
if(i!=(tableau_cours_th_tp.length - 1))
{
detail_points_bal = detail_points_bal + " + ";
}
else
{
detail_points_bal = detail_points_bal + "= " + points_bal;
}
}
else if(tableau_cours_th_tp[i]<8)
{
//alert(tableau_cotes_th[i]);
//alert("points_bal vaut " + points_bal);
points_bal=points_bal+3;
//détail des balances pour les cotes inférieures a 8 :
detail_points_bal = detail_points_bal + "3 (cote < 8)";
if(i!=(tableau_cours_th_tp.length - 1))
{
detail_points_bal = detail_points_bal + " + ";
}
else
{
detail_points_bal = detail_points_bal + "= " + points_bal;
}
}
}
//alert(detail_points_bal);
//alert(points_bal + " points de balances au final");
grade = calcul_grade(total_pond_th_tp,somme_prod_th_tp,nb_abs_j,points_bal);
//alert(grade);
//=SI(AJ10=0;"Tt";SI((NB.SI(D10:R10;"d")>0);"D";"ABS?"))
var SessionCompleteOuPas;
if(nb_abs_j == 0)
{
SessionCompleteOuPas = "Tt";
}
else if (nbDispense>0)
{
SessionCompleteOuPas = "D";
}
else
{
SessionCompleteOuPas = "ABS?";
}
detail_maximum = "";
//=(T10+V10)*20
var maximum = 0;
maximum = (total_pond_th + total_pond_tp) * 20;
//détail maximum
detail_maximum = total_pond_th + " (le total des pondérations TH) + " + total_pond_tp + " (le total des pondérations TP) * 20 = " + maximum;
// alert(detail_maximum);
//alert("maximum : "+maximum);
//=SI(AL10=0;0;AB10/AL10*100)
var Pourcentage = 0;
(maximum==0)?Pourcentage=0:Pourcentage=(somme_prod_th_tp/maximum)*100;
//alert("Pourcentage : "+Pourcentage);
//=NB.SI(D10:R10;"<10")*10-SOMME.SI(D10:R10;"<10";D10:R10) => Je calcule le nombre de cellule strictement inférieur a 10 (1+1+1...) je mulitplie par 10 le total et ensuite je soustrait le produit au total que fait les cellules inférieures a 10 (8+4+7+...)
i=0;
//alert("le tableau vaut ici " + tableau_cours_th_tp_int);
var inferieurA10 = 0;
var balances_tot = 0;
var TotalCellulesInferieuresA10 = 0;
for(i;i<tableau_cours_th_tp_int.length;i++)
{
if(tableau_cours_th_tp_int[i]<10)
{
//alert("une cote inférieure a 10 trouvée => " + tableau_cours_th_tp_int[i]);
inferieurA10++;
TotalCellulesInferieuresA10 = TotalCellulesInferieuresA10 + tableau_cours_th_tp_int[i];
//alert("attention ici => ");
//alert(typeof(tableau_cours_th_tp_int[i]));
//alert("ici : " + TotalCellulesInferieuresA10);
}
}
//alert("inferieurA10 : "+inferieurA10);
//alert("TotalCellulesInferieuresA10 : "+TotalCellulesInferieuresA10);//total des cotes inférieures a 10 => 3 sur 20, 2 sur 20, 5 sur 20 donnera 10
inferieurA10 = inferieurA10 * 10;
//alert("inferieurA10 * 10 = " + inferieurA10);
balances_tot = inferieurA10 - TotalCellulesInferieuresA10;
//alert("TotalCellulesInferieuresA10 = " + TotalCellulesInferieuresA10);
//alert("balances_tot " + balances_tot);
//j'arrondie les moyennes car autrement j'ai quelque chose du genre 7,8777777777776
var moy_th_arrondie = arrondi(moy_th);
var moy_tp_arrondie = arrondi(moy_tp);
var moy_gen_arrondie = arrondi(moy_gen);
var Pourcentage = arrondi(Pourcentage);
maj_table_decision("BA3",matricule,moy_th_arrondie,moy_tp_arrondie,moy_gen_arrondie,grade,Pourcentage,"2008-2009","16 juin 2009");
}
function creation_du_detail()
{
document.getElementById('div_moy_th').innerHTML = detail_moy_th;
} |
Partager