Bug 2497: LERNE AUTO was subtly broken.

This commit is contained in:
Enno Rehling 2018-10-07 08:22:56 +02:00
parent e169e20cc3
commit 0398a1b705
1 changed files with 3 additions and 3 deletions

View File

@ -81,13 +81,13 @@ void autostudy_run(scholar scholars[], int nscholars)
int mint; int mint;
ts += scholars[se].u->number; /* count total scholars */ ts += scholars[se].u->number; /* count total scholars */
mint = (ts + 10) / 11; /* need a minimum of ceil(ts/11) teachers */ mint = (ts + 10) / 11; /* need a minimum of ceil(ts/11) teachers */
for (; mint > tt && si != nscholars; ++si) { for (; mint > tt && si != nscholars && scholars[si].sk == sk; ++si) {
tt += scholars[si].u->number; tt += scholars[si].u->number;
} }
} }
/* now si splits the teachers and students 1:10 */ /* now si splits the teachers and students 1:10 */
/* first student must be 2 levels below first teacher: */ /* first student must be 2 levels below first teacher: */
for (; si != se && scholars[ti].level - TEACHDIFFERENCE > scholars[si].level; ++si) { for (; si != se && scholars[ti].level - TEACHDIFFERENCE > scholars[si].level && scholars[si].sk == sk; ++si) {
tt += scholars[si].u->number; tt += scholars[si].u->number;
} }
if (si == se) { if (si == se) {
@ -134,7 +134,7 @@ void autostudy_run(scholar scholars[], int nscholars)
learning(scholars + s, (n - i)); learning(scholars + s, (n - i));
i = 0; i = 0;
if (++s == se) { if (++s == se) {
continue; break;
} }
n = scholars[s].u->number; n = scholars[s].u->number;
} while (scholars[t].level - TEACHDIFFERENCE < scholars[s].level); } while (scholars[t].level - TEACHDIFFERENCE < scholars[s].level);