Mise à jour
continuous-integration/drone/push Build is passing Details

master
Rémi LAVERGNE 1 year ago
parent e423594cbb
commit bc60c29f50

@ -0,0 +1,50 @@
1 33.80 1.62 64.50
2 45.97 1.21 193.57
3 91.03 0.57 79.36
4 59.32 0.71 100.99
5 34.18 1.43 42.44
6 75.43 2.43 57.86
7 26.11 2.32 155.97
8 31.89 0.92 190.94
9 90.74 0.59 61.87
10 15.63 1.81 148.95
11 62.08 1.47 185.78
12 84.46 2.00 49.14
13 71.74 0.46 177.15
14 81.59 1.08 69.27
15 76.09 1.28 92.17
16 50.92 2.37 28.14
17 73.27 1.07 142.01
18 99.08 2.16 5.51
19 76.33 1.28 66.87
20 47.91 1.28 14.79
21 49.92 0.92 86.80
22 88.98 1.18 127.61
23 11.72 1.97 189.64
24 22.72 0.56 106.91
25 99.43 1.61 52.19
26 73.17 1.78 112.36
27 17.10 2.26 72.91
28 96.59 2.43 43.50
29 16.39 1.36 77.74
30 47.78 1.85 36.03
31 12.49 0.96 170.42
32 53.07 0.32 83.83
33 42.26 0.72 198.57
34 86.22 1.03 195.66
35 46.83 0.37 23.29
36 95.86 1.14 163.49
37 21.67 1.08 188.90
38 16.15 0.32 169.18
39 39.76 2.45 111.22
40 16.23 2.15 142.99
41 13.15 1.05 58.28
42 46.66 0.30 45.97
43 67.64 2.28 23.28
44 98.52 1.71 10.28
45 96.39 1.11 59.34
46 96.30 0.67 159.19
47 45.94 0.62 169.54
48 20.28 1.78 145.46
49 44.08 1.57 169.84
50 80.91 2.13 67.70

@ -1,2 +1,50 @@
1313 11 12.1 0 0
2010 22 12.1 0 0
1 7062 115.95 0 0
2 9392 446.75 0 0
3 7920 418.33 0 0
4 371 288.01 0 0
5 3762 175.85 0 0
6 3427 404.05 0 0
7 6861 148.23 0 0
8 57 201.61 0 0
9 6877 348.38 0 0
10 2497 66.83 0 0
11 5511 34.30 0 0
12 3377 236.79 0 0
13 8021 209.12 0 0
14 7696 283.08 0 0
15 4792 201.22 0 0
16 1423 334.40 0 0
17 919 360.44 0 0
18 3297 105.79 0 0
19 3569 410.50 0 0
20 457 69.42 0 0
21 8400 146.92 0 0
22 6401 205.69 0 0
23 4585 310.51 0 0
24 6228 406.27 0 0
25 635 12.86 0 0
26 9770 486.48 0 0
27 6919 67.96 0 0
28 6703 252.47 0 0
29 708 52.76 0 0
30 4440 425.78 0 0
31 5768 433.09 0 0
32 9810 442.02 0 0
33 6220 256.28 0 0
34 5317 473.44 0 0
35 3284 370.82 0 0
36 2998 426.58 0 0
37 8975 425.60 0 0
38 5877 106.48 0 0
39 1957 343.13 0 0
40 9020 378.99 0 0
41 9675 163.61 0 0
42 8637 288.33 0 0
43 55 350.72 0 0
44 1318 79.63 0 0
45 2598 251.03 0 0
46 8815 302.61 0 0
47 8916 143.71 0 0
48 1503 452.92 0 0
49 7690 435.32 0 0
50 2999 57.94 0 0

@ -45,6 +45,21 @@ void errorHandling(int error)
case -9:
printf("[ERREUR] - Le mot de passe est incorrect.\n");
break;
case -10:
printf("[ERREUR] - Le client est suspendu.\n");
break;
case -11:
printf("[ERREUR] - Le client n'est pas administrateur.\n");
break;
case -12:
printf("[ERREUR] - Vous ne pouvez pas supprimer plus d'articles que vous n'en avez dans votre panier, réessayez.\n");
break;
case -13:
printf("[ERREUR] - Le client n'a pas assez d'argent sur sa cagnotte.\n");
break;
case -14:
printf("[ERREUR] - vous ne pouvez pas supprimer un nombre nul ou négatif d'articles, réessayez.\n");
break;
default:
printf("[ERREUR] - Une erreur s'est produite.\n");
break;

Binary file not shown.

@ -50,7 +50,7 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog, int *in
scanf("%d%*c", &password);
}
if (password == decrypt(clientPassword[*index]))
if (password == clientPassword[*index])
{
if (isAdmin[*index] == 1)
{

@ -36,7 +36,7 @@ void decalageAGaucheFloat(float tab[], int index, int tlog);
//! GESTION CLIENTS
void inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog);
void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog);
void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog);
void deleteClient(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog);
//! GESTION STOCKS
void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlog);
@ -63,11 +63,7 @@ void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_ba
int login(int clientID[], int clientPassword[], int isAdmin[], int tlog, int *index);
int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog);
//! MOT DE PASSE
int encrypt(int password);
int decrypt(int password);
//! MENUS
void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlogItem, int *tlogClient);
void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], int tlogItem, int *tlogBasket);
void opposition(int clientID[], int clientPassword[], int suspended[], int tlogClient)
void opposition(int clientID[], int clientPassword[], int suspended[], int tlogClient);

@ -27,6 +27,12 @@ void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], fl
int choice = 0, constraint;
while (choice != 6)
{
printf("\nTapez sur Entrée pour continuer...");
if (getchar() == '\n') // getchar() pour récupérer le caractère entré par l'utilisateur
{
system("clear"); // Clear le terminal
}
printf("\n=================================\n");
printf(" Menu Client\n");
printf("=================================\n");
@ -35,10 +41,13 @@ void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], fl
printf("3\u2022 Afficher le panier\n");
printf("4\u2022 Réinitialiser le panier\n");
printf("5\u2022 Retirer un article du panier\n");
printf("6\u2022 Quitter\n");
printf("6\u2022 Déconnexion\n");
printf("=================================\n");
printf("Votre choix: ");
scanf("%d", &choice);
system("clear");
switch (choice)
{
case 1:
@ -92,6 +101,12 @@ void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspe
int choice = 0;
while (choice != 10)
{
printf("\nTapez sur Entrée pour continuer...");
if (getchar() == '\n') // getchar() pour récupérer le caractère entré par l'utilisateur
{
system("clear"); // Clear le terminal
}
printf("\n=================================\n");
printf(" Menu Admin\n");
printf("=================================\n");
@ -104,10 +119,13 @@ void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspe
printf("7\u2022 Afficher la liste des articles\n");
printf("8\u2022 Afficher les données d'un client\n");
printf("9\u2022 Afficher la liste des clients\n");
printf("10\u2022 Quitter\n");
printf("10\u2022 Déconnexion\n");
printf("=================================\n");
printf("Votre choix: ");
scanf("%d", &choice);
system("clear");
switch (choice)
{
case 1:
@ -166,6 +184,13 @@ void opposition(int clientID[], int clientPassword[], int suspended[], int tlogC
errorHandling(-7);
return;
}
if(suspended[index] == 0)
{
printf("Votre compte n'est pas suspendu.\n");
return;
}
printf("Entrez votre mot de passe: ");
scanf("%d%*c", &password);
if (password == clientPassword[index])

@ -23,7 +23,7 @@ void inputClient(int id, int passwd, int index, int clientID[], int clientPasswo
// Vérification du dépassement de la taille physique du tableau
if (*tlog == tmaxClients)
{
printf("[ERREUR] - La taille physique du tableau est dépassée, impossible d'ajouter un nouveau client.\n");
errorHandling(-2);
return;
}
@ -34,7 +34,7 @@ void inputClient(int id, int passwd, int index, int clientID[], int clientPasswo
decalageADroiteInt(isAdmin, index, *tlog);
clientID[index] = id;
clientPassword[index] = encrypt(passwd);
clientPassword[index] = passwd;
cagnotte[index] = 0;
suspended[index] = 0;
isAdmin[index] = 0;
@ -107,9 +107,9 @@ void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin
*/
void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlog)
{
int reference = -1;
int reference = -1, index, found;
float weight, volume, price;
while (reference != 0)
while(reference != 0)
{
printf("Entrez la référence du produit ou 0 si vous souhaitez arrêter la saisie: ");
scanf("%d", &reference);
@ -118,37 +118,54 @@ void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float u
printf("Erreur: la référence doit être positive, entrez la référence du produit ou 0 si vous souhaitez arrêter la saisie: ");
scanf("%d", &reference);
}
tabReference[*tlog] = reference;
index = searchTab(tabReference, reference, *tlog, &found);
while(found == 1 && reference != 0)
{
printf("Cette référence existe déjà, réessayer ou tapez 0 si vous souhaitez arrêter la saisie: ");
scanf("%d", &reference);
index = searchTab(tabReference, reference, *tlog, &found);
}
if (reference != 0)
{
printf("Entrez le poids du produit: ");
scanf("%f", &weight);
while (weight <= 0)
while (weight < 0)
{
printf("Erreur, le poids doit être positif");
printf("Erreur: le poids doit être positif, entrez le poids du produit: ");
scanf("%f", &weight);
}
tabWeight[*tlog] = weight;
printf("Entrez le volume du produit: ");
scanf("%f", &volume);
while (volume <= 0)
while (volume < 0)
{
printf("Erreur, le volume doit être positif");
printf("Erreur: le volume doit être positif, entrez le volume du produit: ");
scanf("%f", &volume);
}
tabVolume[*tlog] = volume;
printf("Entrez le prix du produit: ");
scanf("%f", &price);
while (price <= 0)
while (price < 0)
{
printf("Erreur, le prix doit être positif");
printf("Erreur: le prix doit être positif, entrez le prix du produit: ");
scanf("%f", &price);
}
unitPrice[*tlog] = price;
//Décalage
decalageADroiteInt(tabReference, index, *tlog);
decalageADroiteFloat(tabWeight, index, *tlog);
decalageADroiteFloat(tabVolume, index, *tlog);
decalageADroiteFloat(unitPrice, index, *tlog);
tabReference[index] = reference;
tabWeight[index] = weight;
tabVolume[index] = volume;
unitPrice[index] = price;
*tlog++;
}
}
}
/**
@ -180,13 +197,12 @@ void deleteItem(int tabReference[], float tabWeight[], float tabVolume[], float
scanf("%d", &reference);
index = searchTab(tabReference, reference, *tlog, &found);
}
for (i=*tlog; i>index; i--)
{
tabReference[i-1] = tabReference[i];
tabWeight[i-1] = tabWeight[i];
tabVolume[i-1] = tabVolume[i];
unitPrice[i-1] = unitPrice[i];
}
decalageAGaucheInt(tabReference, index, *tlog);
decalageAGaucheFloat(tabWeight, index, *tlog);
decalageAGaucheFloat(tabVolume, index, *tlog);
decalageAGaucheFloat(unitPrice, index, *tlog);
*tlog--;
}
}
@ -201,9 +217,7 @@ void deleteItem(int tabReference[], float tabWeight[], float tabVolume[], float
* @return void
* @warning La saisie s'arrête lorsque l'utilisateur entre 0
*/
//! Ajouter la suppression de la colonne mot de passe.
//! Utiliser la fonction décalaageAGauche
void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog)
void deleteClient(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog)
{
int numClient = -1, index, i, found;
while (numClient != 0)
@ -222,13 +236,13 @@ void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin
scanf("%d", &numClient);
index = searchTab(clientID, numClient, *tlog, &found);
}
for (i=*tlog; i>index; i--)
{
clientID[i-1] = clientID[i];
cagnotte[i-1] = cagnotte[i];
suspended[i-1] = suspended[i];
isAdmin[i-1] = isAdmin[i];
}
decalageAGaucheInt(clientID, index, *tlog);
decalageAGaucheInt(clientPassword, index, *tlog);
decalageAGaucheFloat(cagnotte, index, *tlog);
decalageAGaucheInt(suspended, index, *tlog);
decalageAGaucheInt(isAdmin, index, *tlog);
*tlog--;
}
}

@ -33,11 +33,11 @@ void clientConstraint(float *weight, float *volume, float *price)
scanf("%f", volume);
}
printf("Entrez votre budget maximum ou -1 si vous n'en avait pas: ");
printf("Entrez votre budget maximum ou -1 si vous n'en avez pas: ");
scanf("%f", price);
while (*price < 0 || *price != -1)
while (*price < 0 && *price != -1)
{
printf("Erreur: le prix doit être positif, entrez votre budget maximum ou -1 si vous n'en avait pas: ");
printf("Erreur: le prix doit être positif, entrez votre budget maximum ou -1 si vous n'en avez pas: ");
scanf("%f", price);
}
}
@ -199,14 +199,12 @@ void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_ba
scanf("%d",&qte_to_del);
while(qte_to_del<=0)
{
printf("Erreur, vous ne pouvez pas supprimer un nombre nul ou négatif d'articles, réssayez");
//on pourrait supprimer un nombre nul d'articles,
//mais ça n'a pas de sens car cette fonction à pour but de supprimer des articles
errorHandling(-14);
scanf("%d",&qte_to_del);
}
while(basket_tab_qte[index_to_del]-qte_to_del>=0)
{
printf("Erreur, vous ne pouvez pas supprimer plus d'articles que vous n'en avez dans votre panier, ressayez");
errorHandling(-12);
scanf("%d",&qte_to_del);
}
if (qte_to_del<basket_tab_qte[index_to_del])

@ -1,28 +0,0 @@
/**
* @file passwd.c
* @brief Gestion des mots de passe
*/
#include "main.h"
/**
* @brief Encryption d'un mot de passe avec la méthode de César
* @param password: Mot de passe à encrypter
* @return int: Mot de passe encrypté
*/
int encrypt(int password)
{
password = password;
return password;
}
/**
* @brief Décryption d'un mot de passe
* @param password: Mot de passe à décrypter
* @return int: Mot de passe décrypté
*/
int decrypt(int password)
{
password = password;
return password;
}
Loading…
Cancel
Save