Description:
[web] normalize full_score to 100, more hints on how to submit questions, hint on the disabling to test interface during the last 30 minutes git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@253 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

r125:89874907db3e - - 5 files changed: 25 inserted, 4 deleted

@@ -1,53 +1,57
1 class GraderProcess < ActiveRecord::Base
1 class GraderProcess < ActiveRecord::Base
2
2
3 def self.find_by_host_and_pid(host,pid)
3 def self.find_by_host_and_pid(host,pid)
4 return GraderProcess.find(:first,
4 return GraderProcess.find(:first,
5 :conditions => {
5 :conditions => {
6 :host => host,
6 :host => host,
7 :pid => pid
7 :pid => pid
8 })
8 })
9 end
9 end
10
10
11 def self.register(host,pid,mode)
11 def self.register(host,pid,mode)
12 grader = GraderProcess.find_by_host_and_pid(host,pid)
12 grader = GraderProcess.find_by_host_and_pid(host,pid)
13 if grader
13 if grader
14 grader.mode = mode
14 grader.mode = mode
15 grader.active = nil
15 grader.active = nil
16 grader.task_id = nil
16 grader.task_id = nil
17 grader.task_type = nil
17 grader.task_type = nil
18 grader.save
18 grader.save
19 else
19 else
20 grader = GraderProcess.create(:host => host,
20 grader = GraderProcess.create(:host => host,
21 :pid => pid,
21 :pid => pid,
22 :mode => mode)
22 :mode => mode)
23 end
23 end
24 grader
24 grader
25 end
25 end
26
26
27 def self.find_stalled_process()
27 def self.find_stalled_process()
28 GraderProcess.find(:all,
28 GraderProcess.find(:all,
29 :conditions => ["active AND updated_at < ?",
29 :conditions => ["active AND updated_at < ?",
30 Time.now.gmtime - GraderProcess.stalled_time])
30 Time.now.gmtime - GraderProcess.stalled_time])
31 end
31 end
32
32
33 def report_active(task=nil)
33 def report_active(task=nil)
34 self.active = true
34 self.active = true
35 - self.task_id = task.id
35 + if task!=nil
36 + self.task_id = task.id
37 + else
38 + self.task_id = nil
39 + end
36 self.task_type = task.class.to_s
40 self.task_type = task.class.to_s
37 self.save
41 self.save
38 end
42 end
39
43
40 def report_inactive()
44 def report_inactive()
41 self.active = false
45 self.active = false
42 self.task_id = nil
46 self.task_id = nil
43 self.task_type = nil
47 self.task_type = nil
44 self.save
48 self.save
45 end
49 end
46
50
47 protected
51 protected
48
52
49 def self.stalled_time()
53 def self.stalled_time()
50 return 1.minute
54 return 1.minute
51 end
55 end
52
56
53 end
57 end
@@ -1,18 +1,18
1
1
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
3 %td.info{:align => "center"}
3 %td.info{:align => "center"}
4 = submission_counter+1
4 = submission_counter+1
5 %td.info= format_short_time(submission.submitted_at)
5 %td.info= format_short_time(submission.submitted_at)
6 %td.info{:align => "center"}
6 %td.info{:align => "center"}
7 = link_to('[load]',{:action => 'source', :id => submission.id})
7 = link_to('[load]',{:action => 'source', :id => submission.id})
8 %td.info
8 %td.info
9 - if submission.graded_at!=nil
9 - if submission.graded_at!=nil
10 = "Graded at #{format_short_time(submission.graded_at)}."
10 = "Graded at #{format_short_time(submission.graded_at)}."
11 %br/
11 %br/
12 - = "Score: #{submission.points} " if Configuration['ui.show_score']
12 + = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if Configuration['ui.show_score']
13 = " ["
13 = " ["
14 %tt
14 %tt
15 = submission.grader_comment
15 = submission.grader_comment
16 = "]"
16 = "]"
17 %td.info
17 %td.info
18 = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message }
18 = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message }
@@ -1,20 +1,20
1
1
2 - if submission==nil
2 - if submission==nil
3 = "-"
3 = "-"
4 - else
4 - else
5 - if submission.graded_at==nil
5 - if submission.graded_at==nil
6 Submitted at
6 Submitted at
7 = format_short_time(submission.submitted_at)
7 = format_short_time(submission.submitted_at)
8 - else
8 - else
9 = "Graded at #{format_short_time(submission.graded_at)}, "
9 = "Graded at #{format_short_time(submission.graded_at)}, "
10 - = "score: #{submission.points} " if Configuration['ui.show_score']
10 + = "score: #{(submission.points*100/submission.problem.full_score).to_i} " if Configuration['ui.show_score']
11 = " ["
11 = " ["
12 %tt
12 %tt
13 = submission.grader_comment
13 = submission.grader_comment
14 = "]"
14 = "]"
15 = " | "
15 = " | "
16 = link_to('[msg]', {:action => 'compiler_msg', :id => submission.id}, {:popup => true})
16 = link_to('[msg]', {:action => 'compiler_msg', :id => submission.id}, {:popup => true})
17 = " | "
17 = " | "
18 = link_to('[source]',{:action => 'source', :id => submission.id})
18 = link_to('[source]',{:action => 'source', :id => submission.id})
19 = " | "
19 = " | "
20 = link_to '[submissions]', :action => 'submission', :id => problem_name
20 = link_to '[submissions]', :action => 'submission', :id => problem_name
@@ -1,14 +1,26
1 = user_title_bar(@user)
1 = user_title_bar(@user)
2
2
3 - %h3 Your Messages
3 + .announcementbox
4 + %span{:class => 'title'}
5 + How to submit clarification requests
6 + .announcement
7 + %p
8 + :markdown
9 + The clarification requests should be phrased as yes/no questions.
10 + The answers will be one of the following:
11 + (1) **YES**,
12 + (2) <b>NO</b>,
13 + (3) **ANSWERED IN TASK DESCRIPTION (EXPLICITLY OR IMPLICITLY)**,
14 + (4) **INVALID QUESTION**, and
15 + (5) **NO COMMENT**.
4
16
5 - form_for 'message', nil, :url => { :action => 'create'} do |f|
17 - form_for 'message', nil, :url => { :action => 'create'} do |f|
6 %p
18 %p
7 %b New clarification request
19 %b New clarification request
8 = submit_tag "Post"
20 = submit_tag "Post"
9 %br/
21 %br/
10 = f.text_area :body, :rows => 5, :cols => 100
22 = f.text_area :body, :rows => 5, :cols => 100
11
23
12 %hr/
24 %hr/
13
25
14 = render :partial => 'message', :collection => @messages, :locals => {:reply => false}
26 = render :partial => 'message', :collection => @messages, :locals => {:reply => false}
@@ -1,52 +1,57
1 <%= user_title_bar(@user) %>
1 <%= user_title_bar(@user) %>
2
2
3 <h2>Test Interface</h2>
3 <h2>Test Interface</h2>
4
4
5 + <p>
6 + <b>Note:</b> Test interface will be disabled in the last 30 minutes
7 + of the contest time on your site.
8 + </p>
9 +
5 <% if @problems.length==0 %>
10 <% if @problems.length==0 %>
6 There is no submission
11 There is no submission
7 <% else %>
12 <% else %>
8
13
9 <script type="text/javascript">
14 <script type="text/javascript">
10 var submissionCount = new Array();
15 var submissionCount = new Array();
11 <% @submissions.each do |submission| %>
16 <% @submissions.each do |submission| %>
12 submissionCount[<%= submission.problem_id %>]=<%= submission.number %>;
17 submissionCount[<%= submission.problem_id %>]=<%= submission.number %>;
13 <% end %>
18 <% end %>
14
19
15 function updateSubmissionList() {
20 function updateSubmissionList() {
16 currentProb = document.getElementById("test_request_problem_id").value;
21 currentProb = document.getElementById("test_request_problem_id").value;
17 count = submissionCount[currentProb];
22 count = submissionCount[currentProb];
18 submissionSelect = document.getElementById("test_request_submission_number");
23 submissionSelect = document.getElementById("test_request_submission_number");
19 old_len = submissionSelect.length;
24 old_len = submissionSelect.length;
20 // clear the box
25 // clear the box
21 for(i=0; i<old_len; i++)
26 for(i=0; i<old_len; i++)
22 submissionSelect.remove(0);
27 submissionSelect.remove(0);
23 for(i=count; i>=1; i--) {
28 for(i=count; i>=1; i--) {
24 try {
29 try {
25 submissionSelect.add(new Option(""+i,""+i,false,false),null);
30 submissionSelect.add(new Option(""+i,""+i,false,false),null);
26 } catch(ex) {
31 } catch(ex) {
27 submissionSelect.add(new Option(""+i,""+i,false,false));
32 submissionSelect.add(new Option(""+i,""+i,false,false));
28 }
33 }
29 }
34 }
30 }
35 }
31 </script>
36 </script>
32
37
33 <% if Configuration.show_submitbox_to?(@user) %>
38 <% if Configuration.show_submitbox_to?(@user) %>
34 <div class="submitbox">
39 <div class="submitbox">
35 <%= error_messages_for 'submitted_test_request' %>
40 <%= error_messages_for 'submitted_test_request' %>
36 <% form_for :test_request, nil,
41 <% form_for :test_request, nil,
37 :url => { :action => 'submit'},
42 :url => { :action => 'submit'},
38 :html => { :multipart => true } do |f| %>
43 :html => { :multipart => true } do |f| %>
39 <table>
44 <table>
40 <tr>
45 <tr>
41 <td>Task:</td>
46 <td>Task:</td>
42 <td>
47 <td>
43 <%= select(:test_request,
48 <%= select(:test_request,
44 :problem_id,
49 :problem_id,
45 @problems.collect {|p| [p.name, p.id]}, {},
50 @problems.collect {|p| [p.name, p.id]}, {},
46 { :onclick => "updateSubmissionList();" }) %>
51 { :onclick => "updateSubmissionList();" }) %>
47 </td>
52 </td>
48 </tr>
53 </tr>
49 <tr>
54 <tr>
50 <td>Submission:</td>
55 <td>Submission:</td>
51 <td>
56 <td>
52 <%= select(:test_request,
57 <%= select(:test_request,
You need to be logged in to leave comments. Login now