diff --git a/.gitignore b/.gitignore index 347ec59..7d97cea 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ pkg .idea ## PROJECT::SPECIFIC +.ruby-version +.ruby-gemset diff --git a/lib/models/turkee_task.rb b/lib/models/turkee_task.rb index fb4a233..0ae3de0 100644 --- a/lib/models/turkee_task.rb +++ b/lib/models/turkee_task.rb @@ -67,6 +67,7 @@ def self.save_imported_values(model, param_hash) # Creates a new Mechanical Turk task on AMZN with the given title, desc, etc def self.create_hit(host, hit_title, hit_description, typ, num_assignments, reward, lifetime, duration = nil, qualifications = {}, params = {}, opts = {}) + opts = opts.reverse_merge(:frame_height => HIT_FRAMEHEIGHT) model = typ.to_s.constantize f_url = build_url(host, model, params, opts) @@ -76,9 +77,10 @@ def self.create_hit(host, hit_title, hit_description, typ, num_assignments, rewa hit.description = hit_description hit.reward = reward - hit.lifetime = lifetime.to_i.days.seconds.to_i - hit.duration = duration.to_i.hours.seconds.to_i if duration - hit.question(f_url, :frame_height => HIT_FRAMEHEIGHT) + hit.lifetime = lifetime.to_i # duration in seconds + hit.duration = duration.to_i if duration # duration in seconds + hit.keywords = opts[:keywords] if opts[:keywords] + hit.question(f_url, :frame_height => opts[:frame_height]) unless qualifications.empty? qualifications.each do |key, value| hit.qualifications.add key, value @@ -204,7 +206,8 @@ def completed_assignments? end def expired? - Time.now >= (created_at + hit_lifetime.days) + # Time.now >= (created_at + hit_lifetime.days) + Time.zone.now >= (self.created_at + hit_duration.seconds) end def self.task_items(turkee_task)