You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.5 KiB
101 lines
3.5 KiB
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <strings.h> // strcasecmp : insensitive case
|
|
#include "trois.h"
|
|
|
|
void afficherCandidaturesByDept(ListeCandidats liste, int nbCandidats, char* searchIUT, char* searchDept) {
|
|
float noteGlobale;
|
|
char decision[LEN_MAX], validation[LEN_MAX];
|
|
ListeCandidatures candidatures;
|
|
Candidature* candidature;
|
|
|
|
ListeCandidats liste2 = (ListeCandidats) malloc(nbCandidats*sizeof(Candidat*));
|
|
|
|
if(liste2 == NULL) {
|
|
perror("malloc");
|
|
exit(errno);
|
|
}
|
|
|
|
for (int i=0; i<nbCandidats; i++) {
|
|
memcpy(&liste2[i], &liste[i], sizeof(Candidat*));
|
|
}
|
|
|
|
qsort(liste2, nbCandidats, sizeof(Candidat*), compareCandidats);
|
|
|
|
for(int i=0; i<nbCandidats; i++) {
|
|
candidatures = liste2[i]->listeCandidatures;
|
|
|
|
for(int j=0; j<liste2[i]->nbCandidatures; j++) {
|
|
candidature = candidatures[j];
|
|
|
|
if(strcasecmp(candidature->ville, searchIUT) == 0) {
|
|
if(strcasecmp(candidature->departement, searchDept) == 0) {
|
|
switch (candidature->decision) {
|
|
case 0:
|
|
strcpy(decision, "en cours de traitement");
|
|
break;
|
|
case 1:
|
|
strcpy(decision, "admis");
|
|
break;
|
|
case -1:
|
|
strcpy(decision, "refusé");
|
|
break;
|
|
case 2:
|
|
strcpy(decision, "sur liste d'attente");
|
|
break;
|
|
default:
|
|
strcpy(decision, "inconnu");
|
|
break;
|
|
}
|
|
|
|
switch (candidature->validation) {
|
|
case 0:
|
|
strcpy(validation, "n'a pas encore décidé");
|
|
break;
|
|
case 1:
|
|
strcpy(validation, "refuse la proposition");
|
|
break;
|
|
case -1:
|
|
strcpy(validation, "accepte");
|
|
break;
|
|
default:
|
|
strcpy(validation, "inconnu");
|
|
break;
|
|
}
|
|
|
|
noteGlobale = ((liste2[i]->moyenneMath)*5
|
|
+ (liste2[i]->moyenneFrancais)*10
|
|
+ (liste2[i]->moyenneAnglais)*5
|
|
+ (liste2[i]->moyenneSpecialite)*16)/36;
|
|
|
|
printf("\n\e[4;37mCandidature de '%s %s' pour le département '%s' à l'IUT '%s' :\n\e[0m"
|
|
" - Décision du département : %s,\n - Décision du candidat : %s,\n - Note globale : %.2f\n\n",
|
|
liste2[i]->nom, liste2[i]->prenom, candidature->departement, candidature->ville, decision, validation, noteGlobale);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
free(liste2);
|
|
}
|
|
|
|
void traiterCandidatures(VilleIUT** tiut, int nbVilles, ListeCandidats liste, int nbCandidats, int nbCandidatsAccept, float noteMini) {
|
|
char dept[LEN_MAX], ville[LEN_MAX];
|
|
|
|
strcpy(dept, "Informatique");
|
|
strcpy(ville, "Clermont-Ferrand");
|
|
|
|
int pos = rechercherVille(tiut, nbVilles, ville);
|
|
// tiut[pos]
|
|
|
|
ListeDept ldept = tiut[pos]->ldept;
|
|
|
|
while(ldept != NULL && strcmp(ldept->departement, dept) != 0)
|
|
ldept = ldept->suiv;
|
|
|
|
ldept->noteMinimale = noteMini;
|
|
|
|
//TODO
|
|
} |