# HG changeset patch # User Jittat Fakcharoenphol # Date 2010-03-11 06:17:24 # Node ID 1ba4bf8cd7124696884e12188a772f51b42b2e76 # Parent bdd89e00b68d47b13098ec98957cfbf46e1af63d only grades users in the contest diff --git a/grader b/grader --- a/grader +++ b/grader @@ -108,14 +108,14 @@ end options[:dry_run] = (ARGV.delete('--dry') != nil) - if options[:dry_run] and (not options[:mode] == 'prob') - puts "Dry run currently works only for 'prob' mode." + if options[:dry_run] and (not ['prob','contest'].include? options[:mode]) + puts "Dry run currently works only for 'prob' or 'contest' modes." exit(0) end options[:report] = (ARGV.delete('--report') != nil) if options[:report] and (not ['prob','contest'].include? options[:mode]) - puts "Report currently works only for 'prob' mode." + puts "Report currently works only for 'prob' or 'contest' modes." exit(0) end @@ -144,14 +144,14 @@ puts " REPORT" puts "---------------------" - print "login" + print "login,email" @problems.each_value do |problem| print ",#{problem.name}" end print "\n" @users.each_value do |user| - print "#{user.login}" + print "#{user.login},#{user.email}" @problems.each_value do |problem| if @results.has_key? [user.id, problem.id] print ",#{@results[[user.id,problem.id]][:points]}" @@ -305,7 +305,10 @@ contest.problems.each do |problem| puts "Grading: #{problem.name}" runner.grade_problem(problem, - :user_conditions => lambda {|u| u.contest_finished?}) + :user_conditions => lambda do |u| + u.contest_finished? and + u.contest_ids.include?(contest.id) + end) end if options[:report]