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

@@ -75,16 +75,16
75 @scorearray = Array.new
75 @scorearray = Array.new
76 @users.each do |u|
76 @users.each do |u|
77 ustat = Array.new
77 ustat = Array.new
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
88 end
88 end
89 end
89 end
90 end
90 end
@@ -1,27 +1,27
1 <h1>Hello <%=h @user.full_name %></h1>
1 <h1>Hello <%=h @user.full_name %></h1>
2
2
3 <div class="usermenu">
3 <div class="usermenu">
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',
14 [['Specified in header','-1']] +
10 [['Specified in header','-1']] +
15 @problems.collect {|p| [p.full_name, p.id]},
11 @problems.collect {|p| [p.full_name, p.id]},
16 :selected => '-1' %>
12 :selected => '-1' %>
17 File: <%= file_field_tag 'file' %>
13 File: <%= file_field_tag 'file' %>
18 <%= submit_tag 'Submit' %>
14 <%= submit_tag 'Submit' %>
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| %>
25 <div class="problist-each">
25 <div class="problist-each">
26 <div class="probname">
26 <div class="probname">
27 <%= "#{i+1}: #{p.full_name} (#{p.name})" %>
27 <%= "#{i+1}: #{p.full_name} (#{p.name})" %>
@@ -11,9 +11,9
11 <%= text_field 'problem', 'full_score' %></p>
11 <%= text_field 'problem', 'full_score' %></p>
12
12
13 <p><label for="problem_date_added">Date added</label><br/>
13 <p><label for="problem_date_added">Date added</label><br/>
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
@@ -2,25 +2,31
2
2
3 <div class="usermenu">
3 <div class="usermenu">
4 <%= link_to 'List', :action => 'list' %>
4 <%= link_to 'List', :action => 'list' %>
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| %>
12 <td><%= p.name %></td>
11 <td><%= p.name %></td>
13 <% end %>
12 <% end %>
14 <td>Total</td>
13 <td>Total</td>
15 </tr>
14 </tr>
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