def add_ass(): if request.method == 'POST': teacher = request.form['u'] sub = request.form['s'] term = request.form['t'] week = request.form['w'] file = request.files['f'] i = fetchID(teacher, role="teacher") filename = secure_filename(file.filename) adir = "static/rep/%s/%s/%s/assignments/%s" % (i, sub, term, filename) obj = api.Teacher(usr=teacher) # now for action if (i == None): return "invalid" res = obj.UploadAssignment(sub=sub, term=term, week=week, adir=adir) if (res == 1): os.chdir("static/rep/%s/%s/%s/assignments" % (i, sub, term)) file.save(filename) os.chdir(__PATH__) return 1 return 0
def comment_ass(): if request.method == 'JSON': data = request.get_json() obj = api.Teacher(usr=data['usr']) res = obj.CommentAssignment(qid=data['qid'], s=data['stud'], comment=data['comment']) return res
def remove_note(): if request.method == 'POST': teacher = request.form['u'] sub = request.form['s'] term = request.form['t'] week = request.form['w'] ndir = request.form['n'] i = fetchID(teacher, role="teacher") obj = api.Teacher(usr=teacher) res = obj.DeleteNote(sub=sub, term=term, week=week, ndir=ndir) return res
def mark_ass(): if request.method == 'JSON': data = request.get_json() obj = api.Teacher(usr=data['usr']) res = obj.MarkAssignment(qid=data['qid'], s=data['stud'], score=data['score']) if (res): if ('comment' in data): res2 = obj.CommentAssignment(qid=data['qid'], s=data['stud'], comment=data['comment']) return res