Description:
add warning for check
git-svn-id: http://theory.cpe.ku.ac.th/grader/cli/trunk/scripts@22 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
r9:8595e5379ca6 - - 2 files changed: 44 inserted, 12 deleted
@@ -125,8 +125,12 | |||||
|
125 | exit(0) |
|
125 | exit(0) |
|
126 | end |
|
126 | end |
|
127 |
|
127 | ||
|
|
128 | + grader_mode = 'queue' | ||
|
128 | if ARGV.length >= 1 |
|
129 | if ARGV.length >= 1 |
|
129 | GRADER_ENV = ARGV[0] |
|
130 | GRADER_ENV = ARGV[0] |
|
|
131 | + if ARGV.length >=2 | ||
|
|
132 | + grader_mode = ARGV[1] | ||
|
|
133 | + end | ||
|
130 | else |
|
134 | else |
|
131 | GRADER_ENV = 'exam' |
|
135 | GRADER_ENV = 'exam' |
|
132 | end |
|
136 | end |
@@ -140,21 +144,45 | |||||
|
140 | RAILS_ENV = 'development' |
|
144 | RAILS_ENV = 'development' |
|
141 | require RAILS_APP_DIR + '/config/environment' |
|
145 | require RAILS_APP_DIR + '/config/environment' |
|
142 |
|
146 | ||
|
143 | - talk 'Grader queue' |
|
147 | + case grader_mode |
|
144 | - while true |
|
148 | + when "queue" |
|
145 | - if check_stopfile # created by calling grader stop |
|
149 | + talk 'Grader queue' |
|
146 | - clear_stopfile |
|
150 | + while true |
|
147 | - puts "stopped" |
|
151 | + if check_stopfile # created by calling grader stop |
|
|
152 | + clear_stopfile | ||
|
|
153 | + puts "stopped" | ||
|
|
154 | + exit(0) | ||
|
|
155 | + end | ||
|
|
156 | + | ||
|
|
157 | + task = Task.find(:first, :order => 'created_at') | ||
|
|
158 | + if task!=nil | ||
|
|
159 | + grade(task.submission_id) | ||
|
|
160 | + task.destroy | ||
|
|
161 | + else | ||
|
|
162 | + sleep(1) | ||
|
|
163 | + end | ||
|
|
164 | + end | ||
|
|
165 | + | ||
|
|
166 | + when "prob" | ||
|
|
167 | + prob = Problem.find_by_name(ARGV[2]) | ||
|
|
168 | + if prob==nil | ||
|
|
169 | + puts "cannot find problem: #{ARGV[2]}" | ||
|
148 | exit(0) |
|
170 | exit(0) |
|
149 | end |
|
171 | end |
|
150 | - |
|
172 | + users = User.find(:all) |
|
151 | - task = Task.find(:first, :order => 'created_at') |
|
173 | + users.each do |u| |
|
152 | - if task!=nil |
|
174 | + puts "user: #{u.login}" |
|
153 | - grade(task.submission_id) |
|
175 | + last_sub = Submission.find(:first, |
|
154 | - task.destroy |
|
176 | + :conditions => "user_id = #{u.id} and " + |
|
155 | - else |
|
177 | + "problem_id = #{prob.id}", |
|
156 | - sleep(1) |
|
178 | + :order => 'submitted_at DESC') |
|
|
179 | + if last_sub!=nil | ||
|
|
180 | + grade(last_sub.id) | ||
|
|
181 | + end | ||
|
157 | end |
|
182 | end |
|
158 | end |
|
183 | end |
|
159 |
|
184 | ||
|
160 |
|
185 | ||
|
|
186 | + | ||
|
|
187 | + | ||
|
|
188 | + |
@@ -44,6 +44,10 | |||||
|
44 | ################## |
|
44 | ################## |
|
45 | # Your code here # |
|
45 | # Your code here # |
|
46 | ################## |
|
46 | ################## |
|
|
47 | + | ||
|
|
48 | + puts "YOU HAVE TO EDIT THE CHECKING CODE HERE: #{__FILE__}" | ||
|
|
49 | + exit(127) | ||
|
|
50 | + | ||
|
47 | num_pattern = /^[0-9]*/ |
|
51 | num_pattern = /^[0-9]*/ |
|
48 | if (output_file_content =~ num_pattern) == nil |
|
52 | if (output_file_content =~ num_pattern) == nil |
|
49 | report_wrong.call |
|
53 | report_wrong.call |
You need to be logged in to leave comments.
Login now