Description:
fixed problem edit form git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@27 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

r8:790b1fbd35da - - 4 files changed: 18 inserted, 12 deleted

@@ -78,10 +78,10
78 ustat[0] = u.login
78 ustat[0] = u.login
79 @problems.each do |p|
79 @problems.each do |p|
80 c, sub = Submission.find_by_user_and_problem(u.id,p.id)
80 c, sub = Submission.find_by_user_and_problem(u.id,p.id)
81 - if c!=0
81 + if (c!=0) and (sub.points!=nil)
82 - ustat << sub.points
82 + ustat << [sub.points, (sub.points>=p.full_score)]
83 else
83 else
84 - ustat << 0
84 + ustat << [0,false]
85 end
85 end
86 end
86 end
87 @scorearray << ustat
87 @scorearray << ustat
@@ -4,10 +4,6
4 <%= user_options %>
4 <%= user_options %>
5 </div>
5 </div>
6
6
7 - <hr>
8 -
9 - <p style="color: red"><%= flash[:notice] %></p>
10 -
11 <div class="submitbox">
7 <div class="submitbox">
12 <% form_tag({:action => 'submit'}, :multipart => true) do %>
8 <% form_tag({:action => 'submit'}, :multipart => true) do %>
13 Problem: <%= select 'submission', 'problem_id',
9 Problem: <%= select 'submission', 'problem_id',
@@ -19,6 +15,10
19 <% end %>
15 <% end %>
20 </div>
16 </div>
21
17
18 + <hr/>
19 +
20 + <p style="color: red"><%= flash[:notice] %></p>
21 +
22 <div class="problist">
22 <div class="problist">
23 <% i = 0 %>
23 <% i = 0 %>
24 <% @problems.each do |p| %>
24 <% @problems.each do |p| %>
@@ -14,6 +14,6
14 <%= date_select 'problem', 'date_added' %></p>
14 <%= date_select 'problem', 'date_added' %></p>
15
15
16 <p><label for="problem_available">Available</label><br/>
16 <p><label for="problem_available">Available</label><br/>
17 - <select id="problem_available" name="problem[available]"><option value="false">False</option><option value="true">True</option></select></p>
17 + <%= select("problem","available",[['True',true],['False',false]]) %></p>
18 <!--[eoform:problem]-->
18 <!--[eoform:problem]-->
19
19
@@ -5,7 +5,6
5 <%= link_to 'Main', :controller => 'main', :action => 'list' %>
5 <%= link_to 'Main', :controller => 'main', :action => 'list' %>
6 </div>
6 </div>
7
7
8 -
9 <table border="1">
8 <table border="1">
10 <tr><td>User</td>
9 <tr><td>User</td>
11 <% @problems.each do |p| %>
10 <% @problems.each do |p| %>
@@ -16,11 +15,18
16 <% @scorearray.each do |sc| %>
15 <% @scorearray.each do |sc| %>
17 <tr>
16 <tr>
18 <% total = 0 %>
17 <% total = 0 %>
19 - <% sc.each do |i| %>
18 + <% num_passed = 0 %>
20 - <td><%= i %></td>
19 + <% sc.each_index do |i| %>
21 - <% total += i.to_i %>
20 + <% if i==0 %>
21 + <td><%= sc[i] %></td>
22 + <% else %>
23 + <td><%= sc[i][0] %></td>
24 + <% total += sc[i][0] %>
25 + <% num_passed += 1 if sc[i][1] %>
26 + <% end %>
22 <% end %>
27 <% end %>
23 <td><%= total %></td>
28 <td><%= total %></td>
29 + <td><%= num_passed %></td>
24 </tr>
30 </tr>
25 <% end %>
31 <% end %>
26 </table>
32 </table>
You need to be logged in to leave comments. Login now