Skip to content
This repository
Browse code

Style fixes for review

  • Loading branch information...
commit efdbcbf32e447640bb8d339604a3c82ced990b72 1 parent 67c86d0
Dave Buchfuhrer daveFNbuck authored

Showing 1 changed file with 14 additions and 18 deletions. Show diff stats Hide diff stats

  1. +14 18 app/models/evaluation.rb
32 app/models/evaluation.rb
@@ -141,6 +141,20 @@ class Evaluation < ActiveRecord::Base
141 141
142 142 validates :mturk_qualification, :inclusion => { :in => %w(none trusted master) }
143 143
  144 + # Creates accessors for time fields that converts between seconds and minutes
  145 + # These fields are accessible through :field_in_minutes
  146 + def self.minutes_accessor(*args)
  147 + args.each do |a|
  148 + class_eval do
  149 + name = a.to_s + "_in_minutes"
  150 + define_method(name) { self[a] / 60 }
  151 + define_method(name + "=") { |min| self[a] = min.to_i * 60 }
  152 + end
  153 + end
  154 + end
  155 +
  156 + minutes_accessor :duration, :lifetime, :auto_approve
  157 +
144 158 # Given an array of objects, add a Task to this evaluation for each element
145 159 # of the array
146 160 #
@@ -233,24 +247,6 @@ def Evaluation.based_on base
233 247 return e
234 248 end
235 249
236   - # Creates accessors for time fields that convert from seconds to minutes
237   - # These fields are accessible through :field_in_minutes
238   - def self.minutes_accessor(*args)
239   - args.each do |a|
240   - class_eval do
241   - name = a.to_s + "_in_minutes"
242   - define_method(name) { self[a] / 60 }
243   - define_method(name + "=") { |min| self[a] = min.to_i * 60}
244   - end
245   - end
246   - end
247   -
248   - minutes_accessor :duration, :lifetime, :auto_approve
249   -
250   - def duration_in_minutes=(minutes)
251   - self.duration = minutes.to_i * 60
252   - end
253   -
254 250 # Registers this evaluation as a HIT Type on MTurk, then submits all
255 251 # of this evaluation's tasks as HITs. Tasks are submitted in the background.
256 252 # Returns the Job corresponding to submitting the tasks.

0 comments on commit efdbcbf

Please sign in to comment.
Something went wrong with that request. Please try again.