Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ pkg
.idea

## PROJECT::SPECIFIC
.ruby-version
.ruby-gemset
11 changes: 7 additions & 4 deletions lib/models/turkee_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down