示例#1
0
def goallevelupdate():
#    print ("IN goallevelupdate")
    content = request.get_json(silent=True)
    goalIdStr = content['Goal_id']
    goalStatusStr = content['Status']
    feedback = content['Feedback']
    #Get Task Task
    goal = Goal.query.filter_by(id = int(goalIdStr)).first()
    goal.completionstatus = goalStatusStr #Update Task Status
    #Update All tasks in this goal to "Approved" IF the status is approved, else do nothing
    if goalStatusStr == "Approved" :
        setStatusInAllTasksInGoal(goal.id, status = "Approved" )
    db.session.commit()
    # Get ID, comments, Approved/Returned
    if feedback :
        giverEmpId = getEmpIdByEmail(current_user.username)
        recordGoalFeedback(goal, feedback, giverEmpId = giverEmpId)
#    print (content)
    return "Updated"
def giveFeedback(id=0, year='2018-2019'):
    year = session['year']
    empEmail = current_user.username.lower()
    loginedInEmpId = getEmpIdByEmail(empEmail)

    #Get Info for the top-part : Emp-Name, number, Role, Designation, Department, Manager, IS_DC_LEAD?
    if request.method == "POST":  #and form.validate_on_submit():
        obj = GiveFeedbackForm(request.form)
        #Populate the fields
        ask = FeedbackFromAnyone.query.filter_by(id=id).first()
        ask.feedback = obj.feedback.data[0:998]
        ask.status = "FG"
        ask.empNotified = False  #  Reset notified flag if already set
        db.session.commit()

    form = GiveFeedbackForm(
    )  #Lets not take assessment year for now, but we default it nicely
    if id:
        ask = FeedbackFromAnyone.query.filter_by(id=int(id)).first()
        if ask:
            form = GiveFeedbackForm(
                obj=ask
            )  #Lets not take assessment year for now, but we default it nicely
            task = getTaskById(ask.elementId)
            if task:
                form.task.data = task.description

    allAsks = FeedbackFromAnyone.query.filter_by(giverEmail = empEmail).\
        filter_by(assessmentYear = year).all()
    #Get Task description for display
    for ask in allAsks:
        task = getTaskById(ask.elementId)
        if task:
            ask.taskdescription = task.description
        else:
            ask.taskdescription = "This Task has been deleted."

    return render_template('goalsheet/givefeedback.html',
                           form=form,
                           itemSet=allAsks)
示例#3
0
def tasklevelupdate():
#    print ("IN tasklevelupdate")
    if request.method == "POST" : 
        content = request.get_json(silent=True)
        taskIdStr = content['Task_id']
        taskStatusStr = content['Status']
        feedback = content['Feedback']

    if request.method == "GET" : 
        taskIdStr = request.args.get('Task_id')
        taskStatusStr = request.args.get('Status')
        feedback = request.args.get('Feedback')
                
    #Get Task Task
    task = Task.query.filter_by(id = int(taskIdStr)).first()
    task.completionstatus = taskStatusStr #Update Task Status
    db.session.commit()
    # Get ID, comments, Approved/Returned
    if feedback :
        giverEmpId = getEmpIdByEmail(current_user.username)
        recordTaskFeedback(task, feedback, giverEmpId = giverEmpId)

    return "Updated"
def projRoleFormSetCandidate(form, role):
    app.logger.info("In Candidate-set")
    if form.assignedEmpBcsName:  # Is non-null
        #        app.logger.info("In Candidate-set to:" + form.assignedEmpBcsName.data)
        role.assignedEmpId = getEmpIdByEmail(form.assignedEmpBcsName.data)
    return
def askfeedbackAddUpdate(id=0, year='2018-2019'):
    year = session['year']
    empEmail = current_user.username.lower()
    loginedInEmpId = getEmpIdByEmail(empEmail)

    #Get additional details for the objects to be displayed (e.g. Task Name)
    if request.method == "POST":  #and form.validate_on_submit():
        obj = AskFeedbackForm(request.form)
        if id:
            newAsk = FeedbackFromAnyone.query.filter_by(id=int(id)).first()
            print("Found ask=" + str(newAsk.id))
        else:
            newAsk = FeedbackFromAnyone()
#        obj.populate_obj(newAsk)
#Populate the fields
        if obj.task.data:
            newAsk.elementId = obj.task.data
            newAsk.relationship = obj.relationship.data
            newAsk.elementType = ELEMENT_TYPE_TASK
            newAsk.giverEmail = obj.fromEmail.data
            newAsk.comment = obj.comment.data
            newAsk.receiverEmail = empEmail
            newAsk.feedback = "No Feedback Yet"
            newAsk.dateRecorded = dt.datetime.now()
            newAsk.assessmentYear = year
            newAsk.status = "RQ"
            if not id:
                db.session.add(newAsk)  # Add it to the data base if it was new
            db.session.commit()
        else:
            flash(
                "Please select a valid Task for which you are requesting feedback."
            )
    form = AskFeedbackForm()
    form.fromEmail.choices = getEmailSetForSelect() + [("", "")]  ##
    form.relationship.choices = getRelationshipsForSelect()  ##
    #    form.role.choices = getRolesForSelect() ##
    form.task.choices = getAllTasksForSelect(empEmail, year) + [("", "")]  ##

    if id:
        ask = FeedbackFromAnyone.query.filter_by(id=id).first()
        if ask:
            print("Ask found" + ask.giverEmail)
            form = AskFeedbackForm(
                obj=ask
            )  #Lets not take assessment year for now, but we default it nicely
            form.fromEmail.choices = getEmailSetForSelect()  ##
            form.fromEmail.data = ask.giverEmail  ##
            form.relationship.choices = getRelationshipsForSelect(
                ask.giverEmail)  ##
            form.relationship.data = ask.relationship
            #            form.role.choices = getRolesForSelect() ##
            form.task.choices = getAllTasksForSelect(empEmail, year)  ##
            form.task.data = str(ask.elementId)

    #Get a list of feedbacks already requested
    allAsks = allAsksForUser(empEmail, year)
    #Get Task description for display
    for ask in allAsks:
        print("Ask Element=" + str(ask.elementId))
        task = getTaskById(ask.elementId)
        if task:
            ask.taskdescription = task.description
        else:
            ask.taskdescription = "Task appears to be deleted"
    return render_template('goalsheet/askforfeedback.html',
                           form=form,
                           itemSet=allAsks)