diff --git a/SAE2 b/SAE2 index c606363..378a5f3 100755 Binary files a/SAE2 and b/SAE2 differ diff --git a/includes/charge.h b/includes/charge.h index 8cf2fcf..c3be7ce 100644 --- a/includes/charge.h +++ b/includes/charge.h @@ -34,6 +34,7 @@ void displayOffre(Offre *o); void displayListeDevis(ListeDevis l); void afficherDevisEntreprise(Offre **tabTravaux); void displayPrecedences(Precedence *tabP, int tlog); +void afficherTaches(Tache **tachesTriees, int p_tmax); void enfiler(ListeAttente **file, Tache *tache); void initialiserFileAttente(Tache **tabTache, int nbTaches, ListeAttente **fileAttente); Offre *newOffre(char *travauxName); diff --git a/obj/charge.o b/obj/charge.o index c50048f..5c55ec8 100644 Binary files a/obj/charge.o and b/obj/charge.o differ diff --git a/obj/main.o b/obj/main.o index d468ba7..12067c4 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/obj/structures.o b/obj/structures.o index 7ba73d7..f4730c0 100644 Binary files a/obj/structures.o and b/obj/structures.o differ diff --git a/srcs/charge.c b/srcs/charge.c index c795739..e82a450 100644 --- a/srcs/charge.c +++ b/srcs/charge.c @@ -100,6 +100,8 @@ Offre **loadOffre(void) while (!feof(devisFile)) loadDevis(devisFile, tabTravaux); + for (int i = 0; i < TMAXTRAV; i++) + triFusionListeDevis(&tabTravaux[i]->ldevis, lenListeDevis(tabTravaux[i]->ldevis)); return (tabTravaux); } diff --git a/srcs/main.c b/srcs/main.c index 735bf45..3fc2887 100644 --- a/srcs/main.c +++ b/srcs/main.c @@ -8,8 +8,6 @@ int main() int p_tlog; tabTravaux = loadOffre(); - for (int i = 0; i < TMAXTRAV; i++) - triFusionListeDevis(&tabTravaux[i]->ldevis, lenListeDevis(tabTravaux[i]->ldevis)); minTravaux(tabTravaux); diff --git a/srcs/part4.c b/srcs/part4.c index 7b420cf..5a66271 100644 --- a/srcs/part4.c +++ b/srcs/part4.c @@ -35,4 +35,6 @@ void traiterTaches(Tache **tabTache, int p_tmax) exit(1); } } + + // nouveau tri fusion pour l'ordre des taches } \ No newline at end of file diff --git a/srcs/structures.c b/srcs/structures.c index ef39c22..27821d8 100644 --- a/srcs/structures.c +++ b/srcs/structures.c @@ -212,6 +212,22 @@ int max(int a, int b) return (b); } +int calculerDureeProjet(Tache **tachesTriees, int nbTaches) +{ + int i; + int dureeProjet; + int finTache; + + dureeProjet = 0; + for (i = 0; i < nbTaches; i++) + { + finTache = tachesTriees[i]->dateDebut + tachesTriees[i]->duree; + if (finTache > dureeProjet) + dureeProjet = finTache; + } + return (dureeProjet); +} + /*--------------informations------------*/ // Retourne une liste des successeurs pour un travail donne @@ -239,6 +255,14 @@ Tache* trouverTache(Tache **tabTache, int nbTaches, char *nom) return (NULL); } +void listerTachesRestantes(Tache **tachesTriees, int nbTaches, int date) +{ + printf("Taches restantes a realiser :\n"); + for (int i = 0; i < nbTaches; i++) + if (tachesTriees[i]->dateDebut >= date) + printf("Tache: %s\n", tachesTriees[i]->tache); +} + /*---------------affichages--------------*/ // Affiche les details d'un devis @@ -252,8 +276,9 @@ void displayDevis(Devis d) void displayOffre(Offre *o) { trace("displayOffre"); - printf("\n%s\n", o->travaux); + printf("%s\n", o->travaux); displayListeDevis(o->ldevis); + printf("\n"); } // Affiche les details de la liste de devis @@ -312,13 +337,22 @@ void afficherDevisEntreprise(Offre **tabTravaux) void displayPrecedences(Precedence *tabP, int tlog) { trace("displayPrecedences"); + int i; printf("Liste des precedences :\n"); - for (int i = 0; i < tlog; i++) { + for (i = 0; i < tlog; i++) { printf("\t%s\t\t : \t%s\n", tabP[i].travauxPrec, tabP[i].travauxSucc); } } +void afficherTaches(Tache **tachesTriees, int p_tmax) +{ + int i; + + printf("Tâches triées par date de début :\n"); + for (i = 0; i < p_tmax; i++) + printf("la tache: %s, debute : %d\n", tachesTriees[i]->tache, tachesTriees[i]->dateDebut); +} // Partie 4 (à trier)