From 81ca197020c6ec6fb9c46894fb70659736b13d22 Mon Sep 17 00:00:00 2001 From: Andreas Moik Date: Thu, 30 Jun 2016 16:15:05 +0200 Subject: [PATCH] bugfix --- vilesci/personen/aliquote_reduktion.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vilesci/personen/aliquote_reduktion.php b/vilesci/personen/aliquote_reduktion.php index b06069349..8aa9aa2a4 100644 --- a/vilesci/personen/aliquote_reduktion.php +++ b/vilesci/personen/aliquote_reduktion.php @@ -245,7 +245,7 @@ aqr.studenten.forEach(function(j) { - if((j.applicant || j.selected)) + if(j.rt_gesamtpunkte !== null && j.rt_gesamtpunkte > 0) allCountedStudents.push(j); }); @@ -253,33 +253,31 @@ if(applicantCount > allCountedStudents.length) applicantCount = allCountedStudents.length; - zgvs.forEach(function(i) { var applicantsFromZGV = []; aqr.studenten.forEach(function(j) { - if((j.applicant || j.selected) && j.bezeichnung === i) + if((j.rt_gesamtpunkte !== null && j.rt_gesamtpunkte > 0) && j.bezeichnung === i) applicantsFromZGV.push(j); }); // calculate the aliquote reduction for every ZGV var percent = applicantsFromZGV.length / allCountedStudents.length * 100; - var neededFromZGV = (applicantCount / 100 * percent); + var neededFromZGV = (applicantCount / 100 * percent) - aqr.getAcceptedCount(i); if(neededFromZGV < 0) neededFromZGV = 0; - zgvElems.push({name:i, needed:neededFromZGV, percent:percent, accepted: aqr.getAcceptedCount(i), overallNeeded: (applicantCount / 100 * percent) + aqr.getAcceptedCount(i)}); + zgvElems.push({name:i, needed:neededFromZGV, percent:percent, accepted: aqr.getAcceptedCount(i), overallNeeded: neededFromZGV + aqr.getAcceptedCount(i)}); }); - aqr.zgvElems = JSON.parse(JSON.stringify(zgvElems)); // calculate the already distributed students var residual = 0; zgvElems.forEach(function(i) { - residual += i.needed; + residual += parseInt(i.needed); }); // calculate the difference from needed to already distributed @@ -292,11 +290,13 @@ { if(resDiff > 0) { + i.overallNeeded ++; i.needed ++; resDiff --; } }); } + aqr.zgvElems = JSON.parse(JSON.stringify(zgvElems)); aqr.recursiveChoose(neededStudentsCount, zgvElems); } }