def defineAssignmentType(): classID = request.form.get("classID") if Backend.checkTeacherHasClass(current_user.id, classID): typeName = request.form.get("typeName") value = request.form.get("value") numberLowestToDrop = request.form.get("numberOfLowestToDrop") Backend.defineAssignmentType(classID, typeName, numberLowestToDrop, value) return redirect(url_for("main.teacherHomepage")) else: return '', 403
def editAssignment(): classID = request.form.get("classID") if Backend.checkTeacherHasClass(current_user.id, classID): assignmentID = request.form.get("assignmentID") name = request.form.get("name") description = request.form.get("description") dueDate = request.form.get("dueDate") dueTime = request.form.get("dueTime") aType = request.form.get("type") Backend.editAssignment(current_user.id, classID, assignmentID, name, description, aType, dueDate, dueTime) return redirect(url_for("main.assignmentPageTeacher", classID=classID, assignmentID=assignmentID)) else: return '', 403
def createAssignment(): classID = request.form.get("classID") if Backend.checkTeacherHasClass(current_user.id, classID): name = request.form.get("name") description = request.form.get("description") dueDate = request.form.get("dueDate") dueTime = request.form.get("dueTime") aType = request.form.get("type") Backend.createAssignment(classID, name, description, aType, dueDate, dueTime) Backend.sendOutNotifications(classID, name) return redirect(url_for("main.teacherHomepage")) else: return '', 403
def classHomepageTeacher(): cID = int(request.args.get("classID")) if Backend.checkTeacherHasClass(current_user.id, cID): assignments = [] for assignmentID in Backend.getClassAssignments(cID): assignments.append( Backend.getAssignmentInfo(assignmentID) ) students = [] grades= [] for studentID in Backend.getStudentsForClass(cID): grade = Backend.getFinalGrade(cID, studentID) students.append( { "StudentID":studentID, "StudentName": Backend.getName(studentID), "StudentGrade": grade if grade != -1 else "-" } ) if grade > -1: grades.append(grade) pageData = { "ClassID" : cID, "Name" : Backend.getClassName(cID), "Time" : Backend.getClassTimes(cID), "Location" : Backend.getClassLocations(cID), "Assignments" : assignments, "Announcements": Backend.getAnnouncementsForClass(cID), "Students": students } n = len(grades) if n > 1: pageData["Mean"] = str("%.3f" % mean(grades)) pageData["SD"] = str("%.3f" % stdev(grades)) pageData["Median"] = median(grades) else: pageData["Mean"] = "-" pageData["SD"] = "-" pageData["Median"] = "-" return render_template('classHomepageTeacher.html', pageData=pageData) else: return '', 403
def assignmentPageTeacher(): cID = request.args.get("classID") aID = request.args.get("assignmentID") if Backend.checkTeacherHasClass(current_user.id, cID) and Backend.classHasAssignment(cID, aID): pageData = Backend.getAssignmentInfo(aID) pageData["ClassID"] = cID students = [] grades = [] for student in Backend.getStudentsForClass(cID): curGrade = Backend.getGrade(aID, student) if type(curGrade) is str: curGrade = -1 if curGrade < 0: curGrade = "Not Graded" else: grades.append(curGrade) temp = { "ID": student, "Name":Backend.getName(student), "CurrentGrade": curGrade, "GradeDiscrep": Backend.getDiscrepFlag(aID, student), "CurrentComment": Backend.getTeacherComment(aID, student), "Student Comment": Backend.getStudentComment(aID, student) } students.append(temp) pageData["Students"] = students n = len(grades) if n > 1: pageData["Mean"] = str("%.3f" % mean(grades)) pageData["SD"] = str("%.3f" % stdev(grades)) pageData["Median"] = median(grades) else: pageData["Mean"] = "-" pageData["SD"] = "-" pageData["Median"] = "-" pageData["Complete"] = n pageData["Missing"] = len(students) - n return render_template("assignmentPageTeacher.html", pageData=pageData) else: return '', 403