Description:
does not record login time in analysis mode
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r317:df35763dc517 - - 1 file changed: 3 inserted, 1 deleted

@@ -313,66 +313,68
313 end
313 end
314 end
314 end
315
315
316 # copied from grader/script/lib/test_request_helper.rb
316 # copied from grader/script/lib/test_request_helper.rb
317 def extract_running_stat(results)
317 def extract_running_stat(results)
318 running_stat_line = results[-1]
318 running_stat_line = results[-1]
319
319
320 # extract exit status line
320 # extract exit status line
321 run_stat = ""
321 run_stat = ""
322 if !(/[Cc]orrect/.match(results[0]))
322 if !(/[Cc]orrect/.match(results[0]))
323 run_stat = results[0].chomp
323 run_stat = results[0].chomp
324 else
324 else
325 run_stat = 'Program exited normally'
325 run_stat = 'Program exited normally'
326 end
326 end
327
327
328 logger.info "Stat line: #{running_stat_line}"
328 logger.info "Stat line: #{running_stat_line}"
329
329
330 # extract running time
330 # extract running time
331 if res = /r(.*)u(.*)s/.match(running_stat_line)
331 if res = /r(.*)u(.*)s/.match(running_stat_line)
332 seconds = (res[1].to_f + res[2].to_f)
332 seconds = (res[1].to_f + res[2].to_f)
333 time_stat = "Time used: #{seconds} sec."
333 time_stat = "Time used: #{seconds} sec."
334 else
334 else
335 seconds = nil
335 seconds = nil
336 time_stat = "Time used: n/a sec."
336 time_stat = "Time used: n/a sec."
337 end
337 end
338
338
339 # extract memory usage
339 # extract memory usage
340 if res = /s(.*)m/.match(running_stat_line)
340 if res = /s(.*)m/.match(running_stat_line)
341 memory_used = res[1].to_i
341 memory_used = res[1].to_i
342 else
342 else
343 memory_used = -1
343 memory_used = -1
344 end
344 end
345
345
346 return {
346 return {
347 :msg => "#{run_stat}\n#{time_stat}",
347 :msg => "#{run_stat}\n#{time_stat}",
348 :running_time => seconds,
348 :running_time => seconds,
349 :exit_status => run_stat,
349 :exit_status => run_stat,
350 :memory_usage => memory_used
350 :memory_usage => memory_used
351 }
351 }
352 end
352 end
353
353
354 def confirm_and_update_start_time
354 def confirm_and_update_start_time
355 user = User.find(session[:user_id])
355 user = User.find(session[:user_id])
356 if (Configuration.indv_contest_mode? and
356 if (Configuration.indv_contest_mode? and
357 Configuration['contest.confirm_indv_contest_start'] and
357 Configuration['contest.confirm_indv_contest_start'] and
358 !user.contest_started?)
358 !user.contest_started?)
359 redirect_to :action => 'confirm_contest_start' and return
359 redirect_to :action => 'confirm_contest_start' and return
360 end
360 end
361 - user.update_start_time
361 + if not Configuration.analysis_mode?
362 + user.update_start_time
363 + end
362 end
364 end
363
365
364 def reject_announcement_refresh_when_logged_out
366 def reject_announcement_refresh_when_logged_out
365 if not session[:user_id]
367 if not session[:user_id]
366 render :text => 'Access forbidden', :status => 403
368 render :text => 'Access forbidden', :status => 403
367 end
369 end
368
370
369 if Configuration.multicontests?
371 if Configuration.multicontests?
370 user = User.find(session[:user_id])
372 user = User.find(session[:user_id])
371 if user.contest_stat.forced_logout
373 if user.contest_stat.forced_logout
372 render :text => 'Access forbidden', :status => 403
374 render :text => 'Access forbidden', :status => 403
373 end
375 end
374 end
376 end
375 end
377 end
376
378
377 end
379 end
378
380
You need to be logged in to leave comments. Login now