lib/verdict/tasks.rake in verdict-0.5.0 vs lib/verdict/tasks.rake in verdict-0.6.0

- old
+ new

@@ -25,10 +25,14 @@ end def self.subject_identifier Verdict::Rake.require_env('subject') end + + def self.subject + experiment.fetch_subject(subject_identifier) + end end end namespace :verdict do @@ -44,12 +48,13 @@ desc "Looks up the assignment for a given experiment and subject" task :lookup_assignment => 'environment' do experiment = Verdict::Rake.experiment subject_identifier = Verdict::Rake.subject_identifier + subject = Verdict::Rake.subject - assignment = experiment.lookup_assignment_for_identifier(subject_identifier) + assignment = experiment.lookup(subject) if assignment.nil? Verdict::Rake.stdout.puts "Subject `#{subject_identifier}` is not assigned to experiment `#{experiment.handle}` yet." elsif assignment.qualified? Verdict::Rake.stdout.puts "Subject `#{subject_identifier}` is assigned to group `#{assignment.group.handle}` of experiment `#{experiment.handle}`." else @@ -60,29 +65,32 @@ desc "Manually assign a subject to a given group in an experiment" task :assign_manually => 'environment' do experiment = Verdict::Rake.experiment group = Verdict::Rake.group subject_identifier = Verdict::Rake.subject_identifier + subject = Verdict::Rake.subject - experiment.assign_manually_by_identifier(Verdict::Rake.require_env('subject'), group) + experiment.assign_manually(subject, group) Verdict::Rake.stdout.puts "Subject `#{subject_identifier}` has been assigned to group `#{group.handle}` of experiment `#{experiment.handle}`." end desc "Manually disqualify a subject from an experiment" task :disqualify_manually => 'environment' do experiment = Verdict::Rake.experiment subject_identifier = Verdict::Rake.subject_identifier + subject = Verdict::Rake.subject - experiment.disqualify_manually_by_identifier(subject_identifier) + experiment.disqualify_manually(subject) Verdict::Rake.stdout.puts "Subject `#{subject_identifier}` has been disqualified from experiment `#{experiment.handle}`." end desc "Removes the assignment for a subject so it will be reassigned to the experiment." task :remove_assignment => 'environment' do experiment = Verdict::Rake.experiment subject_identifier = Verdict::Rake.subject_identifier + subject = Verdict::Rake.subject - experiment.remove_subject_assignment_by_identifier(subject_identifier) + experiment.remove_subject_assignment(subject) Verdict::Rake.stdout.puts "Removed assignment of subject with identifier `#{subject_identifier}`." Verdict::Rake.stdout.puts "The subject will be reasigned when it encounters the experiment `#{experiment.handle}` again." end end