Пример #1
0
def new_instructor():
    first_name = request.form['first_name']
    last_name = request.form['last_name']
    date_of_birth = request.form['date_of_birth']
    instructor = InstructorDetails(first_name, last_name, date_of_birth, id)
    details_repository.save(instructor)
    return redirect('/instructors')
 def setUp(self):
     self.instructor_dets = InstructorDetails('Mary', 'Jones',
                                              datetime.date(1992, 3, 12))
     self.instructor = InstructorSchedule(datetime.date(2021, 3,
                                                        22), True, True,
                                          True, True, True, False, False,
                                          datetime.time(9, 0),
                                          datetime.time(17, 0),
                                          self.instructor_dets)
def select_all():
    instructors = []
    sql = "SELECT * FROM instructor_details"
    results = run_sql(sql)
    for row in results:
        instructor = InstructorDetails(row['first_name'], row['last_name'], 
                                      row['date_of_birth'], row['id'])
        instructors.append(instructor)
    return instructors
def select(id):
    instructor = None
    sql = "SELECT * FROM instructor_details WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    if result is not None:
        instructor = InstructorDetails(result['first_name'], result['last_name'], 
                                       result['date_of_birth'], result['id'])
    return instructor
Пример #5
0
                  datetime.date(1968, 12, 1), False, False, None, None)

member_repository.save(member_1)
member_repository.save(member_2)
member_repository.save(member_3)
member_repository.save(member_4)

room_1 = Room('Studio 1', 24, 'Large Room')
room_2 = Room('Studio 2', 4, 'Small Room')
room_3 = Room('Swimming Pool', 50, 'Pool')

room_repository.save(room_1)
room_repository.save(room_2)
room_repository.save(room_3)

instructor_dets_1 = InstructorDetails('Mary', 'Johnson',
                                      datetime.date(1992, 3, 12))
instructor_dets_2 = InstructorDetails('Zach', 'Smith',
                                      datetime.date(1990, 8, 14))
instructor_dets_3 = InstructorDetails('John', 'Wilson',
                                      datetime.date(1990, 8, 14))

# instructor_sch = InstructorSchedule('9-5', True, True, True,
#                                              True, True, False, False, datetime.time(9, 0),
#                                              datetime.time(17, 0))
# instructor_tim = InstructorTimetable(datetime.date(2021, 3, 21), instructor_dets, instructor_sch)

details_repository.save(instructor_dets_1)
details_repository.save(instructor_dets_2)
details_repository.save(instructor_dets_3)
# i_schedule_repository.save(instructor_sch)
# timetable_repository.save(instructor_tim)
 def setUp(self):
     self.instructor = InstructorDetails('Mary', 'Jones',
                                         datetime.date(1992, 3, 12))