Ejemplo n.º 1
0
    def subs_to_grade(cls):
        """
        Returns list for mentor to grade submission
        :return: submission(obj), student(ID-int),
                 ass_title(str), mentor_name(str)
        """
        from app.modules.mod_assigment.assignment import Assignment
        sub_list = cls.list_from_sql()
        list_for_mentor = []
        for sub in sub_list:
            if Student.make_student(sub.ID_STUDENT):
                ass_title = Assignment.query.filter_by(
                    ID=sub.ID_ASSIGMENT).first()

                if ass_title:
                    ass_title = ass_title.TITLE
                else:
                    ass_title = None

                if sub.ID_MENTOR:
                    mentor_name = User.query.filter_by(
                        ID=sub.ID_MENTOR).first()
                    if mentor_name:
                        mentor_name = mentor_name.full_name()
                else:
                    mentor_name = 'None'

                student = Student.make_student(sub.ID_STUDENT)
                list_for_mentor.append([sub, student, ass_title, mentor_name])
        return list_for_mentor
Ejemplo n.º 2
0
def statistics_manager():
    if session['user']['type'] == 'Manager':

        grades = Student.get_students_grades()
        attandance = Student.get_students_attandance()

        return render_template('statistic/statistics_manager.html', user=session['user'], grades=grades, attandance=attandance)
    return redirect(url_for('index'))
def grade_student(checkpoint_id, mentor_id, gradestudent):

    mentor = mentor_id
    if request.method == 'POST':

        student = request.form['student']
        checkpoint_id = request.form['checkpoint']
        grade = request.form['grade' + request.form['student']]

        today = datetime.date.today()
        checkpoint_to_grade = Checkpoint.query.filter_by(
            ID=checkpoint_id).first()
        new_grade = Users_checkpoints(ID_CHECKPOINT=checkpoint_id,
                                      DATE=today,
                                      GRADE=grade,
                                      ID_STUDENT=student,
                                      ID_MENTOR_1=session['user']['id'],
                                      ID_MENTOR_2=mentor,
                                      current_checkpoint=checkpoint_to_grade)
        db.session.add(new_grade)
        db.session.commit()

    students_list = Student.get_students_without_checkpoint(checkpoint_id)

    return redirect(
        url_for('checkpointcontroller.checkpoint_mentor_student',
                user=session['user'],
                checkpoint_id=checkpoint_id,
                mentor=mentor,
                students=students_list))
def index():

    if request.method == 'POST':
        logged_user = User.login(request.form['user_login'], request.form['user_pass'])

        if logged_user is not None:

            user = {'id': logged_user.ID, 'name': logged_user.Name, 'surname': logged_user.Surname,
                    'type': logged_user.Type, 'ave_grade': Student.ave_grade_flask_version(logged_user.ID),
                    'my_attendance': Student.my_attendance(logged_user.ID)}

            session['user'] = user
    if 'user' in session:
        return render_template('index.html', user=session['user'])
    else:
        return render_template('login.html')
    def assignment_list_with_grades(user_id):  # IN USE
        """
        Makes list with assignments visible for student with notation if assignment was submitted
        and how it was graded.
        :param user_id: int (logged user id from seesion)
        :return: assignments_list_to_print (list with all available assignments)
        """
        logged_user = Student.make_student(user_id)
        Assignment.list_from_sql()
        assignments_list = Assignment.pass_assign_for_student()
        assignments_list_to_print = []
        for assignment in assignments_list:
            type_of_assignment = 'Individual'
            if assignment.GROUP == '1':
                type_of_assignment = 'Group'
            new_line = [
                assignment.TITLE, assignment.ID_MENTOR, assignment.START_DATA,
                assignment.END_DATA, type_of_assignment
            ]
            submission = Submission.find_submission(logged_user, assignment)
            if submission:
                new_line.append('submitted')
                if submission.GRADE:
                    new_line.append(submission.GRADE)
                else:
                    new_line.append('None')
            else:
                new_line.append('not submitted')
                new_line.append('None')
            new_line.append(assignment.ID)
            assignments_list_to_print.append(new_line)

        return assignments_list_to_print
def checkpoint_mentor_student(checkpoint_id, mentor):

    if not Mentor.mentor_exist(mentor):
        return redirect(url_for('checkpointcontroller.checkpoint'))

    students_list = Student.get_students_without_checkpoint(checkpoint_id)

    return render_template('checkpoint/checkpoint-select-student.html',
                           user=session['user'],
                           checkpoint_id=checkpoint_id,
                           mentor=mentor,
                           students=students_list)
Ejemplo n.º 7
0
 def add_student_to_team(student_id, team_id):
     """
     Lets user to move student between teams
     :return: None
     """
     student = Student.return_by_id(student_id)
     if student:
         student_team = Team.get_team(student.ID)
         student.id_team = student_team
         team = Team.get_team_by_id(int(team_id))
         if team:
             Team.student_to_team(team, student)
         else:
             print('There is no team with this ID')
     else:
         print('There is no student with this ID')
    def get_attendance_list(date):
        """
        Sets the state of the presence each student at today
        :param date: str 'YYYY-MM-DD'
        :return list_of_attendance: list with Attendance objects
        """

        # EXAMPLE: today = '2017-03-07', date = '2017-03-07'
        today = str(datetime.date.today())
        attendance = Attendance.query.filter_by(DATE=date).first()

        if today == date:
            if attendance:
                pass
            else:
                for student in Student.students_list():
                    new_attendance = Attendance(id_student=student.ID,
                                                date=today)
                    db.session.add(new_attendance)
                db.session.commit()
        list_of_attendance = Attendance.create_attendance_list(date)

        return list_of_attendance
Ejemplo n.º 9
0
def student_list():
    table = Student.students_list()
    if table:
        return render_template('student/student_list.html', table=table, user=session['user'])
    return render_template('student/student_list.html', user=session['user'])