<% dim teacherID, teachername, schoolname teacherID = Cint(request.querystring("teacherID")) teachername = trim(request.querystring("teachername")) if request.querystring("schoolID") <> "" then session("schoolID") = Cint(request.querystring("schoolID")) session("schoolname") = trim(request.querystring("schoolname")) end if schoolID = session("schoolID") schoolname = trim(session("schoolname")) if teachername ="" then dim sqlTeacher sqlTeacher = "SELECT LastName, FirstName from Teacher where TeacherID = "&TeacherID dim objRec1 Set objRec1 = Server.CreateObject("ADODB.Recordset") objRec1.Open sqlTeacher,strConnect,,,adCmdText teachername = objRec1("FirstName")&" "&objRec1("LastName") objRec1.close Set objRec1 = nothing end if dim sqlRating sqlRating = "select Rating.QuestionID, Question, Rating, count(Rating) as Votes, (select count(Rating)/max(QuestionID) from Rating where TeacherID="&teacherID&" group by TeacherID) as Total " &_ " from Rating inner join Question on Rating.QuestionID = Question.QuestionID where TeacherID ="&teacherID&" group by Rating.QuestionID,Question,Rating order by Rating.QuestionID" dim objRec Set objRec = Server.CreateObject("ADODB.Recordset") objRec.cursorlocation = adUseClient objRec.Open sqlRating,strConnect,adOpenDynamic,adLockOptimistic,adCmdText dim aryRating(8,16) dim row, curQuestionID row = 1 curQuestionID = 1 if not objRec.EOF then aryRating(0, row) = 0 while not objRec.EOF if Cint(objRec("QuestionID")) > curQuestionID then row = row +1 aryRating(0, row) = 0 end if aryRating(0, row) = aryRating(0,row) + (Cint(objRec("Rating")) * Cint(objRec("Votes"))) aryRating(1, row) = objRec("QuestionID") aryRating(2, row) = objRec("Question") select case(Cint(objRec("Rating"))) case "5" aryRating(3, row) = objRec("Votes") case "4" aryRating(4, row) = objRec("Votes") case "3" aryRating(5, row) = objRec("Votes") case "2" aryRating(6, row) = objRec("Votes") case "1" aryRating(7, row) = objRec("Votes") end select aryRating(8,row) = objRec("Total") curQuestionID = Cint(objRec("QuestionID")) objRec.movenext wend dim sumRating, avgRating sumRating = 0 avgRating = 0 for row = 1 to 16 sumRating = sumRating + aryRating(0, row) next avgRating = Round(sumRating / (aryRating(8,1) * 16),1) 'avg = sum / (totalvotes * question#) 'if avgRating < 3.0 then avgRating = "3.0" end if objRec.close set objRec = nothing %> Rate Teachers - Your Teacher: <%=teachername%>  (<%=schoolname%>) <% if aryRating(0,1) = "" then %> No ratings found for this teacher.     

Rate this Teacher <% else %>
5 - Strongly Agree

Overall Rating:    <%=avgRating%>    Rate this Teacher

Below lists the number of votes and
average point for each evaluation question.

  Back to <%=schoolname%>

4 - Agree
3 - Average
2 - Disagree
1 - Strongly Disagree
<% for row = 1 to 10 %> <% next %> <% for row = 11 to 16 %> <% next %>
Instructor Evaluation Result5 4 3 2 1 Total Votes Average Point
<%=aryRating(1, row)%> <%=aryRating(2, row)%> <%=aryRating(3, row)%> <%=aryRating(4, row)%> <%=aryRating(5, row)%> <%=aryRating(6, row)%> <%=aryRating(7, row)%> <%=aryRating(8, row)%> <%=Round(aryRating(0, row)/aryRating(8,row),1)%>
Course Evaluation Result5 4 3 2 1 Total Votes Average Point
<%=aryRating(1, row)%> <%=aryRating(2, row)%> <%=aryRating(3, row)%> <%=aryRating(4, row)%> <%=aryRating(5, row)%> <%=aryRating(6, row)%> <%=aryRating(7, row)%> <%=aryRating(8, row)%> <%=Round(aryRating(0, row)/aryRating(8,row),1)%>
 Rate this Teacher
<% end if %>