示例#1
0
def uploadData(teachingid, dataurl):
    now = utils.getNow()
    try:
        teaching = Teaching.objects.filter(id=teachingid).update(dataurl=dataurl, updatetime=now)
    except:
        return None
    else:
        return teaching
示例#2
0
def updateExperimentTamplate(experimentid, templateid):
    now = utils.getNow()
    try:
        experiment = Experiment.objects.filter(id=experimentid).update(templateid=templateid, updatetime=now)
    except:
        return None
    else:
        return experiment
示例#3
0
def updateExperimentdescription(experimentid,experimentdescription):
    now = utils.getNow()
    try:
        experiment = Experiment.objects.filter(id=experimentid).update(desc=experimentdescription, updatetime=now)
    except:
        return None
    else:
        return True
示例#4
0
def addTeaching(experimentid, deadline, teacherid, point, remark, dataurl, stulisturl, templateid, videos):
    now = utils.getNow()
    teaching = Teaching(experimentid=experimentid, deadline=deadline, teacherid=teacherid, point=point, remark=remark,
                        dataurl=dataurl, stulisturl=stulisturl, templateid=templateid, videos=videos,
                        status=CONSTANTS.TEACHING_IS_RUNNING, isdelete=CONSTANTS.ISDELETE_NOT, createtime=now,
                        updatetime=now)
    teaching.save()
    return teaching.id
示例#5
0
def updateExperimentVideos(experimentid, videos):
    now = utils.getNow()
    try:
        experiment = Experiment.objects.filter(id=experimentid).update(videos=videos, updatetime=now)
    except:
        return None
    else:
        return experiment
示例#6
0
def addAdmin(teacherid):
    now = utils.getNow()
    admin = Admin(teacherid=teacherid,
                  isdelete=CONSTANTS.ISDELETE_NOT,
                  createtime=now,
                  updatetime=now)
    admin.save()
    return admin.id
示例#7
0
def updateTeachingVideoById(teachingid, videos):
    now = utils.getNow()
    try:
        teaching = Teaching.objects.filter(id=teachingid).update(videos=videos, updatetime=now)
    except:
        return None
    else:
        return teaching
示例#8
0
def uploadTemplate(teachingid, templateid):
    now = utils.getNow()
    try:
        teaching = Teaching.objects.filter(id=teachingid).update(templateid=templateid, updatetime=now)
    except:
        return None
    else:
        return teaching
示例#9
0
def resetPassword(teacherid):
    try:
        teacher = Teacher.objects.filter(id=teacherid, isdelete=CONSTANTS.ISDELETE_NOT).update(
            password=CONSTANTS.DEFUALT_PASSWORD, updatetime=utils.getNow())
    except:
        return None
    else:
        return teacher
示例#10
0
def addStudent(name, number, filterinfoid):
    now = utils.getNow()
    student = Student(name=name,
                      number=number,
                      filterinfoid=filterinfoid,
                      createtime=now,
                      isdelete=CONSTANTS.ISDELETE_NOT,
                      updatetime=now)
    student.save()
    return student.id
示例#11
0
def saveVideo(name, url, experimentid):
    now = utils.getNow()
    video = Video(name=name,
                  url=url,
                  experimentid=experimentid,
                  isdelete=CONSTANTS.ISDELETE_NOT,
                  createtime=now,
                  updatetime=now)
    video.save()
    return video.id
示例#12
0
def addFilterInfo(registyear, major, classname):
    now = utils.getNow()
    filterinfo = FilterInfo(registyear=registyear,
                            major=major,
                            classname=classname,
                            isdelete=CONSTANTS.ISDELETE_NOT,
                            createtime=now,
                            updatetime=now)
    filterinfo.save()
    return filterinfo.id
示例#13
0
def addReport(teachingid, stunid):
    now = utils.getNow()
    report = Report(stuid=stunid,
                    teachingid=teachingid,
                    score=0,
                    status=CONSTANTS.REPORT_STATUS_PENDING,
                    isdelete=CONSTANTS.ISDELETE_NOT,
                    createtime=now,
                    updatetime=now)
    report.save()
    return report.id
示例#14
0
def updateTeachingDeadlineById(teachingid, deadline):
    now = utils.getNow()
    if now > deadline:
        status = CONSTANTS.TEACHING_IS_STOP
    else:
        status = CONSTANTS.TEACHING_IS_RUNNING
    try:
        teacher = Teaching.objects.filter(id=teachingid).update(deadline=deadline, status=status, updatetime=now)
    except:
        return None
    else:
        return teacher
示例#15
0
def editpassword(request):
    teacherid = utils.getCookie(request, "teacherid")
    if (teacherid is None) or teacherid == "":
        responseReturn = Response(-2, "请登录")
        return HttpResponse(responseReturn.__str__())
    newpwd = utils.getParam(request, "newpwd")
    oldpwd = utils.getParam(request, "oldpwd")
    teacher = TeacherService.getTeacherById(teacherid)
    if oldpwd != teacher.password:
        responseReturn = Response("-1", "原密码输入有误")
        return HttpResponse(responseReturn)
    teacher.password = newpwd
    teacher.updatetime = utils.getNow()
    result = TeacherService.editPassword(teacherid, newpwd)
    if result is not None:
        responseReturn = Response(None, None)
    else:
        responseReturn = Response("-1", "网络忙,请稍后重试!")
    response = HttpResponse(responseReturn.__str__())
    return response
示例#16
0
def addTemplate(experimentid, templateurl):
    now = utils.getNow()
    template = Template(experimentid=experimentid, url=templateurl, isdelete=CONSTANTS.ISDELETE_NOT, createtime=now,
                        updatetime=now)
    template.save()
    return template.id
示例#17
0
def addTeacher(name, number):
    now = utils.getNow()
    teacher = Teacher(name=name, number=number, password=CONSTANTS.DEFUALT_PASSWORD, isdelete=CONSTANTS.ISDELETE_NOT,
                      createtime=now, updatetime=now)
    teacher.save()
    return teacher.id
示例#18
0
def scoreReport(reportid, score):
    report = Report.objects.filter(id=reportid).update(
        score=score,
        status=CONSTANTS.REPORT_STATUS_SCORE,
        updatetime=utils.getNow())
    return report
示例#19
0
def submintReport(reportid, filename):
    report = Report.objects.filter(id=reportid).update(
        url=filename,
        status=CONSTANTS.REPORT_STATUS_SUBMIT,
        updatetime=utils.getNow())
    return report