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
def assignmentPageStudent(): cID = request.args.get("classID") aID = request.args.get("assignmentID") sID = current_user.id if Backend.checkStudentHasClass(current_user.id, cID) and Backend.classHasAssignment(cID, aID): pageData = Backend.getAssignmentInfo(aID) pageData["ClassID"] = cID curGrade = Backend.getGrade(aID, current_user.id) if curGrade == "Not Graded" or curGrade == "Ungraded": curGrade = -1 if curGrade >= 0: pageData["Grade"] = Backend.getGrade(aID, sID) else: pageData["Grade"] = "Not Graded" if Backend.getDiscrepFlag(aID, sID): pageData["Discrep"] = "checked" else: pageData["Discrep"] = "" pageData["Teacher Comment"] = Backend.getTeacherComment(aID, sID) pageData["Student Comment"] = Backend.getStudentComment(aID, sID) return render_template("assignmentPageStudent.html", pageData=pageData) else: return '', 403