Description:
[web] better user_stat git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@138 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r63:787ae01347a6 - - 2 files changed: 3 inserted, 2 deleted

@@ -67,24 +67,25
67 67 def destroy
68 68 User.find(params[:id]).destroy
69 69 redirect_to :action => 'list'
70 70 end
71 71
72 72 def user_stat
73 73 @problems = Problem.find_available_problems
74 74 @users = User.find(:all)
75 75 @scorearray = Array.new
76 76 @users.each do |u|
77 77 ustat = Array.new
78 78 ustat[0] = u.login
79 + ustat[1] = u.full_name
79 80 @problems.each do |p|
80 81 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
81 82 if (sub!=nil) and (sub.points!=nil)
82 83 ustat << [sub.points, (sub.points>=p.full_score)]
83 84 else
84 85 ustat << [0,false]
85 86 end
86 87 end
87 88 @scorearray << ustat
88 89 end
89 90 end
90 91 end
@@ -1,29 +1,29
1 1 <h1>User grading results</h1>
2 2
3 3 <table class="info">
4 - <tr class="info-head"><th>User</th>
4 + <tr class="info-head"><th>User</th><th>Name</th>
5 5 <% @problems.each do |p| %>
6 6 <th><%= p.name %></th>
7 7 <% end %>
8 8 <th>Total</th>
9 9 <th>Passed</th>
10 10 </tr>
11 11 <% counter = 0 %>
12 12 <% @scorearray.each do |sc| %>
13 13 <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>">
14 14 <% total = 0 %>
15 15 <% num_passed = 0 %>
16 16 <% sc.each_index do |i| %>
17 - <% if i==0 %>
17 + <% if i<=1 %>
18 18 <td><%= sc[i] %></td>
19 19 <% else %>
20 20 <td><%= sc[i][0] %></td>
21 21 <% total += sc[i][0] %>
22 22 <% num_passed += 1 if sc[i][1] %>
23 23 <% end %>
24 24 <% end %>
25 25 <td><%= total %></td>
26 26 <td><%= num_passed %></td>
27 27 </tr>
28 28 <% counter += 1 %>
29 29 <% end %>
You need to be logged in to leave comments. Login now