Description:
checks solution by lines
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r384:7f104b042855 - - 1 file changed: 9 inserted, 3 deleted
@@ -290,32 +290,38 | |||
|
290 | 290 | prepare_list_information |
|
291 | 291 | render :action => 'list' and return |
|
292 | 292 | else |
|
293 | 293 | flash[:notice] = 'Error: output file errors' |
|
294 | 294 | prepare_list_information |
|
295 | 295 | render :action => 'list' and return |
|
296 | 296 | end |
|
297 | 297 | end |
|
298 | 298 | |
|
299 | 299 | protected |
|
300 | 300 | |
|
301 | 301 | def grade(output, solution) |
|
302 | - out_items = output.split | |
|
303 | - sol_items = solution.split | |
|
302 | + out_items = output.split("\n") | |
|
303 | + sol_items = solution.split("\n") | |
|
304 | 304 | res = '' |
|
305 | 305 | f = 0 |
|
306 | 306 | s = 0 |
|
307 | 307 | sol_items.length.times do |i| |
|
308 | 308 | f += 1 |
|
309 |
- i |
|
|
309 | + si = sol_items[i].chomp | |
|
310 | + if out_items[i] | |
|
311 | + oi = out_items[i].chomp | |
|
312 | + else | |
|
313 | + oi = '' | |
|
314 | + end | |
|
315 | + if oi == si | |
|
310 | 316 | res = res + 'P' |
|
311 | 317 | s += 1 |
|
312 | 318 | else |
|
313 | 319 | res = res + '-' |
|
314 | 320 | end |
|
315 | 321 | end |
|
316 | 322 | return { :score => s, :full_score => f, :msg => res } |
|
317 | 323 | end |
|
318 | 324 | |
|
319 | 325 | def prepare_announcements(recent=nil) |
|
320 | 326 | if GraderConfiguration.show_tasks_to?(@user) |
|
321 | 327 | @announcements = Announcement.find_published(true) |
You need to be logged in to leave comments.
Login now