Exemplo n.º 1
0
def homeUser() :
    loggedEmail = request.cookies.get("loggedEmail")
    notiList, newNotiNo = notiMiddleware(loggedEmail)

    if request.method == 'GET':
        thesis = fetchThesisWithEmail(loggedEmail)
        step = fetchStepByEmailStep(loggedEmail, STEP_TITLE)
        stepNo = fetchStepNoByEmailStep(loggedEmail)
        # print("sdddate::", request.args )
        sdate = datetime.date.today()+datetime.timedelta(days=1)
        return render_template('homeUser.html', **request.args, thesis=thesis, step=step, stepNo=stepNo, newNotiNo=newNotiNo, sdate=sdate)
    else :
        selectedTitle = request.form["title"]
        userRaw = fetchUserWithEmail(loggedEmail)
        email = userRaw[0]
        name = userRaw[1]
        rollNo = userRaw[2]
        saveThesis(selectedTitle, email, name, rollNo, "2018-2019", 0)
        thesis = fetchThesisWithEmail(loggedEmail)
        return render_template('homeUser.html', **request.args, thesis = thesis, newNotiNo=newNotiNo, )
Exemplo n.º 2
0
def userThird() :
    loggedEmail = request.cookies.get("loggedEmail")
    notiList, newNotiNo = notiMiddleware(loggedEmail)

    if request.method == 'GET':
        loggedEmail = request.cookies.get("loggedEmail")
        thesis = fetchThesisWithEmail(loggedEmail)
        step = fetchStepByEmailStep(loggedEmail, STEP_THIRD)
        stepNo = fetchStepNoByEmailStep(loggedEmail)

        prevStep = fetchStepByEmailStep(loggedEmail, STEP_SECOND)
        sdate = prevStep.deadline+datetime.timedelta(days=1) if prevStep else None
        
        return render_template('homeUser.html', **request.args, step=step, thesis=thesis, stepNo=stepNo, sdate=sdate, newNotiNo=newNotiNo)
    else :
        deadline = request.form["deadline"]
        taskRaw = request.form.getlist("task")

        if len(taskRaw)>0 :
            tasks = commaSeparatedListString(taskRaw)
            saveStep(loggedEmail, STEP_THIRD, deadline, tasks, "")
            return redirect("/userThird")