From 5a9ac3d28fc13badd23a54c6fefc5c078f645b09 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 26 Mar 2016 23:28:36 -0400 Subject: [PATCH] Confirmation before clobbering; only grade certain students. --- lib/kgrader/cli.rb | 5 ++++- lib/kgrader/roster.rb | 4 ---- lib/kgrader/task.rb | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/kgrader/cli.rb b/lib/kgrader/cli.rb index e534587..c08d4ef 100644 --- a/lib/kgrader/cli.rb +++ b/lib/kgrader/cli.rb @@ -47,7 +47,10 @@ module KGrader end def clobber - # TODO: confirm + puts "clobbering means deleting local student repos and roster files" + print "are you sure? [y/N] " + abort "aborted" unless ['y', 'yes'].include? STDIN.gets.strip.downcase + reset_jail reset_desk end diff --git a/lib/kgrader/roster.rb b/lib/kgrader/roster.rb index 0ca2660..d59003d 100644 --- a/lib/kgrader/roster.rb +++ b/lib/kgrader/roster.rb @@ -19,10 +19,6 @@ module KGrader @students ||= @fs.load(rosterfile).map! { |item| item.first } end - def intersect(other) - # TODO - end - private def rosterfile @fs.roster @course.name, @semester diff --git a/lib/kgrader/task.rb b/lib/kgrader/task.rb index 5a96aa0..9863250 100644 --- a/lib/kgrader/task.rb +++ b/lib/kgrader/task.rb @@ -10,9 +10,13 @@ module KGrader end def grade(options = {}) + students = @roster.students + students &= options[:students] unless options[:students].nil? + # TODO puts "Grading #{@course.name}:#{@semester} assignment #{@assignment}..." puts "- options: #{options}" + puts "- students: #{students.inspect}" end def commit(options = {})