def loadTestHistory(): return Associate.testHistory()
def loadCertificatePage(): return Associate.getCertificate(app)
def loadSkills(): return Associate.getSkills()
def loadSkillspage(): return Associate.addSkill()
def loadProfile(): user = session.get('userdatalist', None) return Associate.getProfile(user[0])
def loadAssociateHome(): return Associate.getHome()
def loadTestScore(): return Associate.gettestresults()
def loadTakeTestPage(): return Associate.getQuestions()
def getUserByName ( cls ): if request.method == "POST": conn = DataBaseManager.database_connection() cur = conn.cursor() try: param = request.form [ 'param' ] detailsbyid = Associate.getProfile ( param ) if detailsbyid: return detailsbyid else: name = param query = "select u.eid,u.name,u.email,u.phno,\ r.rolename from users u,roles r where r.roleid=u.roleid and u.name=%s" cur.execute ( query, ( name,)) personaldetails = cur.fetchone() if personaldetails: eid = personaldetails [0] else: return render_template ( 'employeedetailspage.html',\ message = "Employee not found" ) query = "select s.skillname,p.plevel,a.result from skills s,associate_skills a,\ proficiency p where a.skillid=s.skillid and p.pid=a.pid and a.eid=%s" cur.execute ( query, ( eid, )) skills=cur.fetchall() newlist = [] for touple in skills: newlist.append ( touple [0] ) query = "select t.teamname,c.cname from teams t,\ competency c, user_teams ut where ut.teamid=t.teamid and \ ut.cid=c.cid and ut.eid=%s" cur.execute ( query, ( eid, )) teamdetails = cur.fetchone() query = "select at.eid,s.skillname,td.testname,td.testdate,at.score,\ p.plevel,at.result from test_details td, associate_test_details at,\ proficiency p, skills s where at.skillid=s.skillid and at.pid=p.pid \ and td.testid=at.testid and at.eid=%s and at.status='taken'" cur.execute ( query, ( eid, ) ) testdetails = cur.fetchall() testdetails.reverse() profiledetails = [] if personaldetails: profiledetails.append ( personaldetails ) else : return render_template ( 'employeedetailspage.html',\ message = "Employee not found" ) if skills: profiledetails.append ( newlist ) else : profiledetails.append ( None ) if teamdetails: profiledetails.append ( teamdetails ) else : profiledetails.append ( None ) if testdetails: profiledetails.append ( testdetails ) else : profiledetails.append ( None ) return render_template ( 'profilepage.html', details =profiledetails ) finally: conn.close() return render_template ( 'employeedetailspage.html' )