Untitled
unknown
python
3 years ago
1.6 kB
8
Indexable
from Student import Student
from Note import *
import uuid
from datetime import date
class StudentService:
def __init__(self):
self.students_list = []
def add_student(self, student):
self.students_list.append(student)
def show_students_list(self):
for student in self.students_list:
print(student.__repr__())
def delete_student(self, id):
for student in self.students_list:
if student.id == id:
self.students_list.remove(student)
def update_student(self, id, name, surname):
for student in self.students_list:
if student.id == id:
student.name = name
student.surname = surname
def show_student_by_id(self, id):
for student in self.students_list:
if student.id == id:
return student
def show_notes_by_uuid(self, uuid):
for student in self.students_list:
if student.uuid == uuid:
print(f"Student: {student.name} {student.surname}, notes: {student.notes}")
service = StudentService()
student = Student('Izabela', 'Greszta')
service.add_student(student)
#service.show_students_list()
student = Student('Marta', 'Sommer')
service.add_student(student)
#service.show_students_list()
student = Student('Jakub', 'Rucki')
service.add_student(student)
service.show_students_list()
note = Note(NoteValue.THREE_ZERO, ExamType.EXAM, Term.THIRD, uuid, date)
#
# student.add_note(note)
#
# service.show_students_list()
student.add_note(note)
service.show_students_list()
Editor is loading...