コード例 #1
0
ファイル: view_teacher.py プロジェクト: hugosmoon/hitvmm
def getTeachingCount(teacherid):
    runCount = TeachingService.getCountPageByTea(teacherid,
                                                 CONSTANTS.TEACHING_IS_RUNNING)
    stopCount = TeachingService.getCountPageByTea(teacherid,
                                                  CONSTANTS.TEACHING_IS_STOP)
    teachingCount = {"runCount": runCount, "stopCount": stopCount}
    return teachingCount
コード例 #2
0
ファイル: view_teacher.py プロジェクト: hugosmoon/hitvmm
def v_completedteaching(request):
    teacherid = utils.getCookie(request, "teacherid")
    if (teacherid is None) or teacherid == "":
        return getloginResponse(request)
    teachername = utils.getCookie(request, "teachername")
    page = utils.getParam(request, "page")
    if (page is None) or page == "":
        page = 1
    else:
        page = int(page)
    count = TeachingService.getCountPageByTea(teacherid,
                                              CONSTANTS.TEACHING_IS_STOP)
    countpage = 0
    i = 0
    if count > 0:
        if count % 10 > 0:
            i = 1
        countpage = count / 10 + i
    teachingList = TeachingService.getTeachingByTea(teacherid,
                                                    CONSTANTS.TEACHING_IS_STOP,
                                                    page)
    experimentList = ExperimentService.getAllExperiment()
    # 获取用于菜单的实验列表
    experimentMenuList = []
    for experiment in experimentList:
        experimentTemp = experiment.copy()
        experimentName = experimentTemp["name"]
        if len(experimentName) > 8:
            experimentName = experimentName[0:10] + "..."
        experimentTemp["name"] = experimentName
        experimentMenuList.append(experimentTemp)

    teachingCount = getTeachingCount(teacherid)

    return render(
        request, "completedteaching.html", {
            "teachingList": teachingList,
            "experimentList": experimentList,
            "countpage": countpage,
            "teachingCount": teachingCount,
            "experimentMenuList": experimentMenuList,
            "teachername": teachername
        })