Beispiel #1
0
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([Classes, Student, Studentclass], safe=True)
    try:
        fake = Faker()
      
        for i in range(10):
            Student.create(
                name=fake.name(),
                email=fake.email(),
                age=20
            )
        
    except IntegrityError:
        pass
    try:
        Classes.create(
            title="Python",
            description="Learning the beautiful language"
        )
        Classes.create(
            title="Javascript",
            description="Language of the web"
        )
    except IntegrityError:
        pass

    DATABASE.close()
Beispiel #2
0
def students_registered_class(classes):
    active_class = Classes.select().where(Classes.title**classes).get()
    student_ids = Studentclass.select().where(
        Studentclass.classes_id == active_class.id)
    results = []
    for student_id in student_ids:
        student = Student.select().where(Student.id == student_id).get()
        results.append({'name': student.name, 'email': student.email})
    return jsonify(results)
Beispiel #3
0
    def post(self):
        class_id = request.json['class_id']
        class_name = request.json['class_name']
        teacher = request.json['teacher']
        section = request.json['section']
        classroom = request.json['classroom']
        days = request.json['days']
        time = request.json['time']

        new_class = Classes(class_id, class_name, teacher, section, classroom,
                            days, time)

        db.session.add(new_class)

        try:
            db.session.commit()
        except:
            db.session.rollback()
        finally:
            db.session.close()

        return "success"
Beispiel #4
0
 def get_classes_and_subject_with_class_id(self, class_id):
     response_subject = Classes().get_with_id(class_id)
     if not response_subject:
         return None, None
     response_classes = Classes().get_with_subject_id(class_id)
     return response_subject, response_classes
Beispiel #5
0
 def get_class_and_room_with_room_id(self, room_id):
     response_room = Rooms().get_with_id(room_id)
     if not response_room:
         return None, None
     response_classes = Classes().get_with_room_id(room_id)
     return response_room, response_classes
Beispiel #6
0
def course_registration():
    all_classes = Classes.select()
    all_students = Student.select()
    return render_template('course_registration.html',
                           all_classes=all_classes,
                           all_students=all_students)
from timetable_scraper import get_timetable, TimetableType
from lesson_printer import LessonPrinter
from models.teachers import Teachers
from models.classes import Classes




teachers = Teachers("data/teachers.txt")
classes = Classes("data/classes.csv", teachers)
timetable = get_timetable(classes.classes_from_name["8.E"], TimetableType.Current)
lp = LessonPrinter(timetable)
print("8.E:")
print("Default:")
print(lp.get_week())
print("All:")
print(lp.get_week(include_teacher=True, include_theme=True))
print("Changes:")
print(lp.get_week(only_changes=True))
print("")
print("Petr Brousek:")
br_timetable = get_timetable(teachers.teachers_from_abbreviation["Br"], TimetableType.Current)
br_lp = LessonPrinter(br_timetable)
print("Default:")
print(br_lp.get_week(include_groups=True))
print("Changes:")
print(br_lp.get_week(only_changes=True))