Permalink
Browse files

Style fixes for review

  • Loading branch information...
1 parent 67c86d0 commit efdbcbf32e447640bb8d339604a3c82ced990b72 Dave Buchfuhrer committed Aug 18, 2012
Showing with 14 additions and 18 deletions.
  1. +14 −18 app/models/evaluation.rb
View
@@ -141,6 +141,20 @@ class Evaluation < ActiveRecord::Base
validates :mturk_qualification, :inclusion => { :in => %w(none trusted master) }
+ # Creates accessors for time fields that converts between seconds and minutes
+ # These fields are accessible through :field_in_minutes
+ def self.minutes_accessor(*args)
+ args.each do |a|
+ class_eval do
+ name = a.to_s + "_in_minutes"
+ define_method(name) { self[a] / 60 }
+ define_method(name + "=") { |min| self[a] = min.to_i * 60 }
+ end
+ end
+ end
+
+ minutes_accessor :duration, :lifetime, :auto_approve
+
# Given an array of objects, add a Task to this evaluation for each element
# of the array
#
@@ -233,24 +247,6 @@ def Evaluation.based_on base
return e
end
- # Creates accessors for time fields that convert from seconds to minutes
- # These fields are accessible through :field_in_minutes
- def self.minutes_accessor(*args)
- args.each do |a|
- class_eval do
- name = a.to_s + "_in_minutes"
- define_method(name) { self[a] / 60 }
- define_method(name + "=") { |min| self[a] = min.to_i * 60}
- end
- end
- end
-
- minutes_accessor :duration, :lifetime, :auto_approve
-
- def duration_in_minutes=(minutes)
- self.duration = minutes.to_i * 60
- end
-
# Registers this evaluation as a HIT Type on MTurk, then submits all
# of this evaluation's tasks as HITs. Tasks are submitted in the background.
# Returns the Job corresponding to submitting the tasks.

0 comments on commit efdbcbf

Please sign in to comment.