# HG changeset patch # User jittat # Date 2008-01-19 17:32:39 # Node ID 790b1fbd35da4f62e8bfbb0a57ad7e48ddcde38d # Parent c26a2fa9de8ca1014c0928931ade401f028c9af2 fixed problem edit form git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@27 6386c4cd-e34a-4fa8-8920-d93eb39b512e diff --git a/app/controllers/user_admin_controller.rb b/app/controllers/user_admin_controller.rb --- a/app/controllers/user_admin_controller.rb +++ b/app/controllers/user_admin_controller.rb @@ -78,10 +78,10 @@ ustat[0] = u.login @problems.each do |p| c, sub = Submission.find_by_user_and_problem(u.id,p.id) - if c!=0 - ustat << sub.points + if (c!=0) and (sub.points!=nil) + ustat << [sub.points, (sub.points>=p.full_score)] else - ustat << 0 + ustat << [0,false] end end @scorearray << ustat diff --git a/app/views/main/list.rhtml b/app/views/main/list.rhtml --- a/app/views/main/list.rhtml +++ b/app/views/main/list.rhtml @@ -4,10 +4,6 @@ <%= user_options %> -
- -

<%= flash[:notice] %>

-
<% form_tag({:action => 'submit'}, :multipart => true) do %> Problem: <%= select 'submission', 'problem_id', @@ -19,6 +15,10 @@ <% end %>
+
+ +

<%= flash[:notice] %>

+
<% i = 0 %> <% @problems.each do |p| %> diff --git a/app/views/problems/_form.rhtml b/app/views/problems/_form.rhtml --- a/app/views/problems/_form.rhtml +++ b/app/views/problems/_form.rhtml @@ -14,6 +14,6 @@ <%= date_select 'problem', 'date_added' %>


-

+<%= select("problem","available",[['True',true],['False',false]]) %>

diff --git a/app/views/user_admin/user_stat.rhtml b/app/views/user_admin/user_stat.rhtml --- a/app/views/user_admin/user_stat.rhtml +++ b/app/views/user_admin/user_stat.rhtml @@ -5,7 +5,6 @@ <%= link_to 'Main', :controller => 'main', :action => 'list' %>
- <% @problems.each do |p| %> @@ -16,11 +15,18 @@ <% @scorearray.each do |sc| %> <% total = 0 %> - <% sc.each do |i| %> - - <% total += i.to_i %> + <% num_passed = 0 %> + <% sc.each_index do |i| %> + <% if i==0 %> + + <% else %> + + <% total += sc[i][0] %> + <% num_passed += 1 if sc[i][1] %> + <% end %> <% end %> + <% end %>
User
<%= i %><%= sc[i] %><%= sc[i][0] %><%= total %><%= num_passed %>