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