diff --git a/.DS_Store b/.DS_Store index 450fa5260957417979a4fceeb7accfaa24bedc19..65ed2bfe4e0b291c8f2ddbbf10a1035dcacd3dad 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Data_Base.xlsx b/Data_Base.xlsx index 120e1ff2f3611fc448aae7f91eb8f85f9ec407ad..a0bff13121b7287921df9bffebf55b07e2a27c6d 100644 Binary files a/Data_Base.xlsx and b/Data_Base.xlsx differ diff --git a/projet_en_groupe/~$excel_filename.xlsx b/projet_en_groupe/~$excel_filename.xlsx deleted file mode 100644 index d10daf560a7f8247050905285b3e618c244966d6..0000000000000000000000000000000000000000 Binary files a/projet_en_groupe/~$excel_filename.xlsx and /dev/null differ diff --git a/projet_personnel/algorithme_gestion_etudiants.py b/projet_personnel/algorithme_gestion_etudiants.py index fb95ddf33d58b23e8b0a1aaf486396d582410e5d..08d46fe3cd7764dbbd9a11733cc03224271b171b 100644 --- a/projet_personnel/algorithme_gestion_etudiants.py +++ b/projet_personnel/algorithme_gestion_etudiants.py @@ -36,7 +36,7 @@ email_pattern = re.compile(r'^[a-zA-Z0-9._%+-]+@student\.uclouvain\.be$') gender_pattern = re.compile(r'^[MFO]$') academic_year_pattern = re.compile(r'^(BAC[123]|MA[12])$') campus_pattern = re.compile(r'^(Louvain-la-Neuve|Mons)$', re.IGNORECASE) - +curriculum_pattern = re.compile(r'^(INGM1BA|INGM2M)$', re.IGNORECASE) # REGISTER def register_student(data): @@ -113,6 +113,11 @@ def register_student(data): break # Exit the loop if the academic year is valid else: print("The academic year is not valid. Make sure to follow the requested format.") + + if Academic_year in ['BAC1', 'BAC2', 'BAC3'] : + Curriculum = "INGM1BA" + else : + Curriculum = "INGM2M" Courses_and_grade = {} if Academic_year == 'MA2': @@ -159,15 +164,16 @@ def register_student(data): else: print("The campus choice is not valid. Make sure to follow the requested format.") - register(data, Firstname, Lastname, Date_of_birth, Place_of_birth, Address, Telephone, Email, Gender, Academic_year, Courses_and_grade, Campus) + register(data, Firstname, Lastname, Curriculum, Date_of_birth, Place_of_birth, Address, Telephone, Email, Gender, Academic_year, Courses_and_grade, Campus) -def register(data, firstname, lastname, date_of_birth, place_of_birth, address, telephone, email, gender, academic_year, courses_and_grade, campus): +def register(data, firstname, lastname,Curriculum, date_of_birth, place_of_birth, address, telephone, email, gender, academic_year, courses_and_grade, campus): matricule = generate_matricule(firstname, lastname, date_of_birth) student = { "Name": firstname, "Surname": lastname, + "Curriculum":Curriculum, "Date of Birth": date_of_birth, "Place of Birth": place_of_birth, "Address": address, @@ -320,13 +326,45 @@ def modify(data): print("The gender is not valid. Make sure to follow the requested format.") elif field_to_modify == 9: while True: - academic_year = input("What is your academic year? (BAC1/BAC2/BAC3/MA1/MA2): ") - if academic_year_pattern.match(academic_year): - print(f"The academic year is valid : {academic_year}") - data.at[student_index, 'Academic Year'] = academic_year - break # Exit the loop if the academic year is valid + academic_year = input("What is your academic year? (BAC1/BAC2/BAC3/MA1/MA2): ") + + if academic_year_pattern.match(academic_year): + print(f"The academic year is valid: {academic_year}") + + if academic_year in ['BAC1', 'BAC2', 'BAC3']: + curriculum = "INGM1BA" + elif academic_year in ['MA1', 'MA2']: + curriculum = "INGM2M" + else: + print("Invalid academic year for curriculum assignment.") + continue + + data.at[student_index, 'Academic Year'] = academic_year + data.at[student_index, 'Curriculum'] = curriculum + break # Exit the loop if the academic year is valid + else: + print("The academic year is not valid. Make sure to follow the requested format.") + elif field_to_modify == 10: + while True: + curriculum = input("What is your curriculum? (INGM1BA/INGM2M): ") + + if curriculum_pattern.match(curriculum): + if curriculum == 'INGM1BA': + valid_academic_years = ['BAC1', 'BAC2', 'BAC3'] + elif curriculum == 'INGM2M': + valid_academic_years = ['MA1', 'MA2'] + + academic_year = input(f"What is your academic year? ({'/'.join(valid_academic_years)}): ") + + if academic_year in valid_academic_years and academic_year_pattern.match(academic_year): + print(f"The academic year for {curriculum} is valid: {academic_year}") + data.at[student_index, 'Academic Year'] = academic_year + data.at[student_index, 'Curriculum'] = curriculum + break # Exit the loop if both curriculum and academic year are valid + else: + print("Invalid academic year for the selected curriculum. Make sure to follow the requested format.") else: - print("The academic year is not valid. Make sure to follow the requested format.") + print("Invalid curriculum. Make sure to follow the requested format.") elif field_to_modify == 11: # Courses and grades print("Courses already passed and their grade:\n") for course, grade in data.iloc[student_index].items(): @@ -384,6 +422,7 @@ field_mapping = { 8: 'Gender', 9: 'Academic Year', 10: 'Curriculum', + 11: 'Courses and Grades', 12: 'Campus' } diff --git a/projet_personnel/algorithme_student_generate.py b/projet_personnel/algorithme_student_generate.py index 9206e0c9f049c7115597eadd6fc073c79d619c53..9e24be519bbf3e62816697c233564c31e6c2a676 100644 --- a/projet_personnel/algorithme_student_generate.py +++ b/projet_personnel/algorithme_student_generate.py @@ -103,6 +103,12 @@ for each in range(number_of_students): # générer des données # année de cours academic_year = random.choice(school_years) + # curriculum + if academic_year in ['BAC1', 'BAC2', 'BAC3'] : + curriculum = "INGM1BA" + else : + curriculum = "INGM2M" + # ville de naissance de la personne city_of_birth = random.choice(place_of_birth) @@ -184,7 +190,7 @@ for each in range(number_of_students): # générer des données grades[courses] = random.randint(0, 20) - data_generated.append({"Firstname": last_name, "Lastname": first_name, "Academic Year" : academic_year, "Place of Birth" : city_of_birth , "Telephone": phone, "Address": adress_of_student, "Genre" : gender_of_student, "Email" : email_formated, "Campus" : campus, "Date of Birth" : complete_date_of_birth, "Matricule" : matricule, **grades}) + data_generated.append({"Firstname": last_name, "Lastname": first_name, "Academic Year" : academic_year, "Curriculum" : curriculum, "Place of Birth" : city_of_birth , "Telephone": phone, "Address": adress_of_student, "Genre" : gender_of_student, "Email" : email_formated, "Campus" : campus, "Date of Birth" : complete_date_of_birth, "Matricule" : matricule, **grades}) # génération de données qui ne peuvent pas se ressembler