Rendu Finale | fonction rejeterVoeux marche à moitié

master
Alexis LAURENT 2 years ago
parent c0f3bafa48
commit 1f65a2b3a1

54
SAE.c

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

Loading…
Cancel
Save