Rendu Finale | fonction rejeterVoeux marche à moitié

master
Alexis LAURENT 2 years ago
parent c0f3bafa48
commit 1f65a2b3a1

52
SAE.c

@ -180,6 +180,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle, Candidat **tcandid, int *nbCandid,
return;
}
break;
break;
}
}
@ -1114,7 +1115,8 @@ void gestionCandid(VilleIUT **tiut, int nbIUT, Candidat **tcandid, int *nbCandid
clearpage();
break;
case 7:
gérerAdmiCandid(tcandid, *nbCandid);
gererAdmiCandid(tcandid, *nbCandid);
break;
case 9:
choix = gestionMenuAdmin(tiut, nbIUT);
if (choix == -1)
@ -1312,7 +1314,7 @@ void supprimerCandidDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int
decalageGaucheDept(aux->tabDept, pos, aux->nbChoix);
aux->nbChoix = aux->nbChoix - 1;
if (aux->nbChoix == 0)
suppressionCandid(tcandid[iCandid]->idCandIUT, ville, aux->tabDept, aux->nbChoix);
tcandid[iCandid]->idCandIUT = suppressionCandid(tcandid[iCandid]->idCandIUT, ville, aux->tabDept, aux->nbChoix);
printf("voeux supprimmé !\n");
break;
}
@ -1661,6 +1663,7 @@ int gestionResponsable(VilleIUT **tiut, int nbEle, Candidat **tcandid, int taill
return 0;
while (1)
{
system("clear");
choix = menuResponsableAffiche();
system("clear");
switch (choix)
@ -1861,29 +1864,30 @@ void afficher1AdmiCandid(Candidat **tab,int nbCandid, int id, int pos)
}
}
void rejeterVoeux(ListeCandid l, char ville[])
void rejeterVoeux(ListeCandid l, char ville[], int pos)
{
MaillonCandid *aux;
aux = l;
int i=0;
while(l != NULL)
while(aux == NULL)
{
aux = l->suiv;
while(1)
if (aux->tabDept[pos]->decisionCandid == 1 && strcmp(aux->iutCandid, ville) == 0)
{
if (i >= l->nbChoix)
break;
if (l->tabDept[i]->decisionCandid == 0)
free(l->tabDept[i]);
decalageGaucheDept(l->tabDept, i, l->nbChoix);
l->nbChoix = l->nbChoix;
if (l->nbChoix == 0)
for(i = 0; i < aux->nbChoix; i++)
{
if(aux->tabDept[pos]->decisionCandid == 0)
free(aux->tabDept[i]);
}
aux = l;
while(aux != NULL)
{
if(strcmp(aux->iutCandid, ville)==0)
{
suppressionCandid(l, ville, l->tabDept, l->nbChoix);
break;
aux = aux->suiv;
}
if(l->tabDept[i]->decisionCandid != 0) i = i + 1;
else suppressionCandid(aux, aux->iutCandid, aux->tabDept, aux->nbChoix);
}
}
l = aux;
}
}
@ -1943,7 +1947,9 @@ void gererAdmiCandid(Candidat **tab, int nbCandid)
{
printf("Voeux accepter\n");
aux->tabDept[irech]->decisionCandid = 1;
rejeterVoeux(tab[i]->idCandIUT, ville);
rejeterVoeux(tab[i]->idCandIUT, ville, irech);
aux->tabDept[0] = aux->tabDept[irech];
aux->nbChoix = 1;
}
if (choix == 2)
{
@ -1953,7 +1959,7 @@ void gererAdmiCandid(Candidat **tab, int nbCandid)
decalageGaucheDept(aux->tabDept, irech, aux->nbChoix);
aux->nbChoix = aux->nbChoix;
if (aux->nbChoix == 0)
suppressionCandid(tab[i]->idCandIUT, ville, aux->tabDept, aux->nbChoix);
tab[i]->idCandIUT = suppressionCandid(tab[i]->idCandIUT, ville, aux->tabDept, aux->nbChoix);
printf("voeux supprimé !\n");
}
else break;
@ -1963,17 +1969,19 @@ void gererAdmiCandid(Candidat **tab, int nbCandid)
}
}
if (!verifSelection())
break;
return;
}
}
if(!verifSelection())
break;
return;
}
if(!verifSelection())
return;
}
}
if (!verifSelection())
break;
return;
}
}

@ -258,7 +258,7 @@ void afficherAdmiCandid(Candidat **tab,int nbCandid);
void afficher1AdmiCandid(Candidat **tab,int nbCandid, int id, int pos);
void rejeterVoeux(ListeCandid l, char ville[]);
void rejeterVoeux(ListeCandid l, char ville[], int pos);
int decision(void);

Loading…
Cancel
Save