Guest User

Untitled

a guest
Jun 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. ## controller
  2. def dan2
  3. # Last CPP Course Term (Format "200510") fall 2005
  4. last_cpp_course_term = "200510"
  5.  
  6. # First Java Course Term (Format "200610") fall 2006
  7. first_java_course_term = "200520"
  8.  
  9. # CPP Courses
  10. courses_152_cpp = Course.find(:all, :conditions => "section LIKE 'CSC 152%' AND term_code <= '#{last_cpp_course_term}'").collect { |course| course.class_id }
  11.  
  12. # CPP Grades
  13. @grades_152_cpp = Grade.count(:group => :final_grade, :conditions => {:class_id => courses_152_cpp})
  14.  
  15. # Java Courses
  16. courses_152_java = Course.find(:all, :conditions => "section LIKE 'CSC 152%' AND term_code >= '#{first_java_course_term}'").collect { |course| course.class_id }
  17.  
  18. # Java Grades
  19. @grades_152_java = Grade.count(:group => :final_grade, :conditions => {:class_id => courses_152_java})
  20.  
  21.  
  22. end
  23.  
  24. #### dan2
  25. <h1>How did CSC152 Students Compare C++ VS Java</h1>
  26.  
  27. <h2>152 with java</h2>
  28. <table>
  29. <tr>
  30. <th>Grade</th><th>Count</th>
  31. </tr>
  32.  
  33. <% for grade in @grades_152_java %>
  34. <tr>
  35. <td><%= grade[0] %></td>
  36. <td><%= grade[1] %></td>
  37. </tr>
  38. <% end %>
  39. </table>
  40.  
  41. <h2>152 without java</h2>
  42. <table>
  43. <tr>
  44. <th>Grade</th><th>Count</th>
  45. </tr>
  46.  
  47. <% for grade in @grades_152_cpp %>
  48. <tr>
  49. <td><%= grade[0] %></td>
  50. <td><%= grade[1] %></td>
  51. </tr>
  52. <% end %>
  53. </table>
Add Comment
Please, Sign In to add comment