Example #1
0
 def display_students(self):
     first_line_text = "Nom : {}"
     second_line_text = "Prénoms : {}"
     third_line_text = "Mle : {} Classe {}"
     table_entries = dbmanager.get_all(dbmanager.DbStudent)
     for entry in table_entries:
         text = first_line_text.format(entry.name)
         secondary_text = second_line_text.format(entry.surname)
         tertiary_text = third_line_text.format(entry.id, entry.class_id)
         self.cst_rv.data.append({
             'text': text,
             'secondary_text': secondary_text,
             'tertiary_test': tertiary_text
         })
Example #2
0
 def display_teachers(self):
     first_line_text = "Nom : {}"
     second_line_text = "Prénoms : {}"
     third_line_text = "Matiere : {}"
     table_entries = dbmanager.get_all(dbmanager.DbTeacher)
     for entry in table_entries:
         item = ThreeLineAvatarListItem()
         item.text = first_line_text.format(entry.name)
         item.secondary_text = second_line_text.format(entry.surname)
         item.tertiary_text = third_line_text.format(entry.topic_name)
         item.secondary_theme_text_color = 'Primary'
         item.tertiary_theme_text_color = "Primary"
         # item.width = self.parent.width/2
         icon = ImageLeftWidget()
         icon.source = f"teacher_px.png"
         item.add_widget(icon)
         self.avatars_list.add_widget(widget=item)
Example #3
0
def search(type):
    if not (type == "score" or type == "problems"):
        type = "score"

    user = request.form["user"]
    users = convert(get_all(type), 1)
    amount = get_amount()
    filtered = filter(lambda u: u["username"] == user, users)
    
    if filtered:
        rank = filtered[0]["rank"]
        page = (rank-1) / 1000 + 1
    else:
        rank = -1
        page = 1

    users_list = get_all_by(type, page)
    return render_template("search.html", users=convert(users_list, page), amount=amount, page=page, rank=rank, url=type)
Example #4
0
def search(type):
    if not (type == "score" or type == "problems"):
        type = "score"

    user = request.form["user"]
    users = convert(get_all(type), 1)
    amount = get_amount()
    filtered = filter(lambda u: u["username"] == user, users)

    if filtered:
        rank = filtered[0]["rank"]
        page = (rank - 1) / 1000 + 1
    else:
        rank = -1
        page = 1

    users_list = get_all_by(type, page)
    return render_template("search.html",
                           users=convert(users_list, page),
                           amount=amount,
                           page=page,
                           rank=rank,
                           url=type)
Example #5
0
 def switch_to_entities_screen(self, btn_name):
     my_screens = MyScreens()
     if btn_name == "reports_btn":
         print("button name is 1 : ", btn_name)
         my_screens.setcurrent(my_screens.stats_screen)
     elif btn_name == "students_btn":
         print("button name is 2 : ", btn_name)
         my_screens.setcurrent(my_screens.students_screen)
     elif btn_name == "class_btn":
         print("button name is 3 :", btn_name)
         # print("previous data : " + str(performx.PxApp.get_running_app()
         #                                .my_student_teacher_classe_screen.cst_rv.data))
         classes = dbmanager.get_all(dbmanager.DbClassroom)
         classes_data = []
         for classe in classes:
             name = classe.id
             # updating number of students in the classroom
             classe.nb_students = dbmanager.get_number_of_students_from_given_class(name)
             nb_students = classe.nb_students
             pp_id = dbmanager.get_principal_teacher_mle(name)
             pp_name_surname = ""
             if pp_id:
                 pp = dbmanager.get_teacher_by_id(pp_id)[0]
                 print("pp is : "+str(pp))
                 pp_name_surname = pp.name + " " + pp.surname
                 pp_name_surname = 'Professeur principal : ' + pp_name_surname
             entry = {'text_1': 'Classe : ' + name, 'text_2': 'Effectif : ' + str(nb_students), 'text_3': pp_name_surname}
             classes_data.append(entry)
         performx.PxApp.get_running_app().change_cst_rv_data(classes_data)
         print("clock here ? ")
         my_screens.setcurrent(my_screens.class_screen)
     elif btn_name == "teachers_btn":
         print("button name is 4 : ", btn_name)
         my_screens.setcurrent(my_screens.teachers_screen)
     else:
         #   This should never occur
         pass
Example #6
0
 def __init__(self, **kwargs):
     self.topics_names = [
         'Anglais', 'Allemand', 'Comm. Ecrite', 'Dictee', 'EPS', 'Espagnol',
         'Hist-Géo', 'IM', 'Lecture', 'PCT', 'Philosophie', 'SVT'
     ]
     self.classrooms = [
         "6eme", "5eme", "4eme A", "4eme B", "3eme A", "3eme B", "2nde A",
         "2nde C", "2nde D", "1ere A", "1ere C", "1ere D", "Tle A", "Tle C",
         "Tle D"
     ]
     self.countries = [
         "Benin", "Burkina-Faso", "Centrafrique", "Cote d\'Ivoire", "Niger",
         "Senegal", "Tchad", "Togo"
     ]
     self.initialize_db()
     self.teachers = get_teachers_name_surnames_mle(
         dbmanager.get_all_teachers())
     print("teachers list :", self.teachers)
     self.registered_classrooms = dbmanager.get_all(dbmanager.DbClassroom)
     print("classes list :", self.registered_classrooms)
     self.registered_class_name = []
     for cl in self.registered_classrooms:
         self.registered_class_name.append(cl.id)
     print("classes names list : ", self.registered_class_name)