cloudfactory 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -0
- data/lib/cf/badge.rb +7 -9
- data/lib/cf/cli/line.rb +19 -16
- data/lib/cf/cli/line_yaml_validator.rb +3 -3
- data/lib/cf/cli/production.rb +3 -1
- data/lib/cf/run.rb +10 -9
- data/lib/cf/station.rb +1 -1
- data/lib/cf/version.rb +1 -1
- data/spec/badges_spec.rb +56 -2
- data/spec/human_worker_spec.rb +1 -1
- data/spec/line_spec.rb +6 -6
- data/spec/run_spec.rb +2 -2
- data/spec/stat_badge_spec.rb +2 -2
- data/spec/station_spec.rb +6 -6
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.5.2 (2012-03-1)
|
2
|
+
* Badge made reusability under same account
|
3
|
+
* Added options for starting production with gold-standard
|
4
|
+
* variable pricing
|
5
|
+
|
1
6
|
## 0.5.1 (2012-02-22)
|
2
7
|
* Bug fixed for problem in options with block DSL
|
3
8
|
* Default Worker Pool changed to mTurk
|
data/lib/cf/badge.rb
CHANGED
@@ -20,7 +20,7 @@ module CF
|
|
20
20
|
|
21
21
|
def initialize(options={})
|
22
22
|
options.symbolize_keys!
|
23
|
-
if
|
23
|
+
if options[:test_attributes] && options[:test_attributes][:form_attributes]
|
24
24
|
form = options[:test_attributes][:form_attributes]
|
25
25
|
if( form[:type] == "CustomTaskForm" && form[:file])
|
26
26
|
raw_html = ""
|
@@ -32,11 +32,9 @@ module CF
|
|
32
32
|
options[:test_attributes][:form_attributes].merge!({:_type =>"TaskForm"}) if form[:type] == "TaskForm"
|
33
33
|
end
|
34
34
|
@settings = options
|
35
|
-
@station = options
|
36
|
-
@line = options
|
37
|
-
if
|
38
|
-
options.delete(:station) if @settings[:station].present?
|
39
|
-
options.delete(:line)
|
35
|
+
@station = options.delete(:station)
|
36
|
+
@line = options.delete(:line)
|
37
|
+
if @line.present? && @station.present?
|
40
38
|
request =
|
41
39
|
{
|
42
40
|
:body =>
|
@@ -46,9 +44,9 @@ module CF
|
|
46
44
|
}
|
47
45
|
}
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
resp = HTTParty.post("#{CF.api_url}#{CF.api_version}/lines/#{CF.account_name}/#{@line.title.downcase}/stations/#{@station.index}/badges.json",request)
|
48
|
+
@station.badges = self
|
49
|
+
self.errors = resp.parsed_response['error']['message'] if resp.code != 200
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
data/lib/cf/cli/line.rb
CHANGED
@@ -26,7 +26,7 @@ module Cf # :nodoc: all
|
|
26
26
|
class Line < Thor # :nodoc: all
|
27
27
|
include Cf::Config
|
28
28
|
include Cf::LineYamlValidator
|
29
|
-
|
29
|
+
|
30
30
|
desc "line generate LINE-TITLE", "generates a line template at <line-title>/line.yml"
|
31
31
|
method_option :force, :type => :boolean, :default => false, :aliases => "-f", :desc => "force to overwrite the files if the line already exists, default is false"
|
32
32
|
|
@@ -47,7 +47,7 @@ module Cf # :nodoc: all
|
|
47
47
|
say "Title for the line is required.", :red
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
desc "line delete", "delete the current line at http://cloudfactory.com"
|
52
52
|
method_option :line, :type => :string, :aliases => "-l", :desc => "specify the line-title to delete"
|
53
53
|
method_option :force, :type => :boolean, :aliases => "-f", :default => false, :desc => "force delete the line"
|
@@ -119,7 +119,7 @@ module Cf # :nodoc: all
|
|
119
119
|
say("!!! Warning !!!\nThe following are the existing production runs based on this line.", :yellow)
|
120
120
|
existing_runs = Cf::Production.new([],{'line' => line_title, 'all' => true})
|
121
121
|
existing_runs.list
|
122
|
-
|
122
|
+
|
123
123
|
say("\n!!! Warning !!!\nDeleting this line will also delete all the existing production runs based on this line.\n", :yellow)
|
124
124
|
delete_forcefully = agree("Do you still want to delete this line? [y/n] ")
|
125
125
|
say("\n")
|
@@ -134,14 +134,14 @@ module Cf # :nodoc: all
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
def display_error(line_title, error_message)
|
139
139
|
say("Error: #{error_message}", :red)
|
140
140
|
rollback(line_title)
|
141
141
|
exit(1)
|
142
142
|
end
|
143
143
|
}
|
144
|
-
|
144
|
+
|
145
145
|
method_option :force, :type => :boolean, :default => false, :aliases => "-f", :desc => "force to overwrite the line if the line already exists, default is false"
|
146
146
|
desc "line create", "takes the line.yml and creates a new line at http://cloudfactory.com"
|
147
147
|
def create
|
@@ -327,13 +327,16 @@ module Cf # :nodoc: all
|
|
327
327
|
if badges
|
328
328
|
say "Adding Badges to station", :green
|
329
329
|
badges.each do |s_badge|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
330
|
+
if s_badge.length == 1 && s_badge.keys.include?("name")
|
331
|
+
else
|
332
|
+
form = s_badge["test_attributes"]["form_attributes"]
|
333
|
+
unless form.blank?
|
334
|
+
if form["type"] == "CustomTaskForm"
|
335
|
+
file = File.read("#{line_source}/#{form["file"]}") || File.read("#{line_source}/badges/station#{station_file['station']['station_index']}.html")
|
336
|
+
s_badge["test_attributes"]["form_attributes"].merge!({:raw_html => file, :_type =>"CustomTaskForm" })
|
337
|
+
else
|
338
|
+
s_badge["test_attributes"]["form_attributes"].merge!({:_type =>"TaskForm" })
|
339
|
+
end
|
337
340
|
end
|
338
341
|
end
|
339
342
|
badge = CF::Badge.new(s_badge.merge({:line => line,:station => s }))
|
@@ -393,7 +396,7 @@ module Cf # :nodoc: all
|
|
393
396
|
set_target_uri(false)
|
394
397
|
set_api_key(yaml_source)
|
395
398
|
CF.account_name = CF::Account.info['name']
|
396
|
-
|
399
|
+
|
397
400
|
if options.all
|
398
401
|
resp_lines = CF::Line.all(:page => 'all')
|
399
402
|
current_page = 1
|
@@ -410,7 +413,7 @@ module Cf # :nodoc: all
|
|
410
413
|
lines = resp_lines['lines'].presence
|
411
414
|
say "\n"
|
412
415
|
say("You don't have any lines to list", :yellow) and return if lines.blank?
|
413
|
-
|
416
|
+
|
414
417
|
if resp_lines['total_pages']
|
415
418
|
say("Showing page #{current_page} of #{resp_lines['total_pages']}\tTotal lines: #{resp_lines['total_lines']}")
|
416
419
|
end
|
@@ -436,7 +439,7 @@ module Cf # :nodoc: all
|
|
436
439
|
desc "line details", "list the details of the line"
|
437
440
|
method_option :line, :type => :string, :aliases => "-l", :desc => "specify the line-title to inspect"
|
438
441
|
# method_option :verbose, :type => :boolean, :aliases => "-v", :desc => "gives the detailed structure of the line"
|
439
|
-
def details
|
442
|
+
def details
|
440
443
|
if options['line'].blank?
|
441
444
|
line_source = Dir.pwd
|
442
445
|
yaml_source = "#{line_source}/line.yml"
|
@@ -453,7 +456,7 @@ module Cf # :nodoc: all
|
|
453
456
|
CF.account_name = CF::Account.info['name']
|
454
457
|
line_title = options['line'].parameterize
|
455
458
|
end
|
456
|
-
|
459
|
+
|
457
460
|
line = CF::Line.inspect(line_title)
|
458
461
|
line = Hashie::Mash.new(line)
|
459
462
|
if line.error.blank?
|
@@ -51,7 +51,7 @@ module Cf
|
|
51
51
|
elsif !jury_worker.nil?
|
52
52
|
reward = jury_worker['reward']
|
53
53
|
errors << "Reward for Jury worker is missing in block of Tournament Station #{i+1}!" if reward.nil?
|
54
|
-
errors << "Reward Must be greater than 0 in Block station #{i+1}!" if !reward.nil? && reward < 1
|
54
|
+
# errors << "Reward Must be greater than 0 in Block station #{i+1}!" if !reward.nil? && reward < 1
|
55
55
|
end
|
56
56
|
acceptance_ratio = station['station']['acceptance_ratio']
|
57
57
|
if !acceptance_ratio.nil?
|
@@ -92,8 +92,8 @@ module Cf
|
|
92
92
|
reward = worker['reward']
|
93
93
|
if reward.nil?
|
94
94
|
errors << "Reward of workers not specified in Block station #{i+1}!"
|
95
|
-
else
|
96
|
-
errors << "Reward of workers must be greater than 0 in Block station #{i+1}!" if reward < 1
|
95
|
+
# else
|
96
|
+
# errors << "Reward of workers must be greater than 0 in Block station #{i+1}!" if reward < 1
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
data/lib/cf/cli/production.rb
CHANGED
@@ -66,6 +66,7 @@ module Cf # :nodoc: all
|
|
66
66
|
|
67
67
|
desc "production start <run-title>", "creates a production run with input data file at input/<run-title>.csv for more option 'cf production help start'"
|
68
68
|
method_option :input_data, :type => :string, :aliases => "-i", :desc => "the name of the input data file"
|
69
|
+
method_option :gold_standards, :type => :string, :aliases => "-g", :desc => "number of goldstandard for the run"
|
69
70
|
method_option :live, :type => :boolean, :default => false, :desc => "specifies sandbox or live mode"
|
70
71
|
method_option :line, :type => :string, :aliases => "-l", :desc => "public line to use to do the production run. the format should be <account_name>/<line-title> e.g. millisami/brandiator"
|
71
72
|
def start(title=nil)
|
@@ -149,8 +150,9 @@ module Cf # :nodoc: all
|
|
149
150
|
say("The input data file named #{input_data} is missing", :red) and return
|
150
151
|
end
|
151
152
|
|
153
|
+
gold_standards = options[:gold_standards]
|
152
154
|
say "Creating a production run with title #{run_title}", :green
|
153
|
-
run = CF::Run.create(line_title, run_title, input_data_file)
|
155
|
+
run = CF::Run.create(line_title, run_title, input_data_file, gold_standards)
|
154
156
|
if run.errors.blank?
|
155
157
|
display_success_run(run)
|
156
158
|
else
|
data/lib/cf/run.rb
CHANGED
@@ -26,7 +26,7 @@ module CF
|
|
26
26
|
# ==OR
|
27
27
|
# You can pass line object instead of passing line title:
|
28
28
|
# run = CF::Run.new(line_object, "run name", file_path)
|
29
|
-
def initialize(line, title, input)
|
29
|
+
def initialize(line, title, input, gold_standards = nil)
|
30
30
|
if line.class == CF::Line || line.class == Hashie::Mash
|
31
31
|
@line = line
|
32
32
|
@line_title = line.title
|
@@ -41,24 +41,25 @@ module CF
|
|
41
41
|
@title = title
|
42
42
|
if File.exist?(input.to_s)
|
43
43
|
@file = input
|
44
|
+
@gold_standards = gold_standards
|
44
45
|
@param_data = File.new(input, 'rb')
|
45
46
|
@param_for_input = :file
|
46
47
|
if line.class == String && line.split("/").count == 2
|
47
|
-
resp = self.class.post("/lines/#{@account}/#{@line_title.downcase}/runs.json", {:data => {:run => {:title => @title}}, @param_for_input => @param_data})
|
48
|
+
resp = self.class.post("/lines/#{@account}/#{@line_title.downcase}/runs.json", {:data => {:run => {:title => @title, :gold_standards => @gold_standards }}, @param_for_input => @param_data})
|
48
49
|
else
|
49
|
-
resp = self.class.post("/lines/#{CF.account_name}/#{@line_title.downcase}/runs.json", {:data => {:run => {:title => @title}}, @param_for_input => @param_data})
|
50
|
+
resp = self.class.post("/lines/#{CF.account_name}/#{@line_title.downcase}/runs.json", {:data => {:run => {:title => @title, :gold_standards => @gold_standards}}, @param_for_input => @param_data})
|
50
51
|
end
|
51
52
|
self.errors = resp['error']['message'] if resp['code'] != 200
|
52
53
|
else
|
53
54
|
@input = input
|
54
55
|
@param_data = input
|
55
56
|
@param_for_input = :inputs
|
56
|
-
options =
|
57
|
+
options =
|
57
58
|
{
|
58
|
-
:body =>
|
59
|
+
:body =>
|
59
60
|
{
|
60
61
|
:api_key => CF.api_key,
|
61
|
-
:data =>{:run => { :title => @title }, :inputs => @param_data}
|
62
|
+
:data =>{:run => { :title => @title, :gold_standards => @gold_standards }, :inputs => @param_data}
|
62
63
|
}
|
63
64
|
}
|
64
65
|
if line.class == String && line.split("/").count == 2
|
@@ -80,10 +81,10 @@ module CF
|
|
80
81
|
# ==OR
|
81
82
|
# You can pass line object instead passing line title:
|
82
83
|
# run = CF::Run.new(line_object, "run name", file_path)
|
83
|
-
def self.create(line, title, file)
|
84
|
-
Run.new(line, title, file)
|
84
|
+
def self.create(line, title, file, gold_standards = nil)
|
85
|
+
Run.new(line, title, file, gold_standards)
|
85
86
|
end
|
86
|
-
|
87
|
+
|
87
88
|
# ==Adds units to an existing production Run
|
88
89
|
# ===Usage Example:
|
89
90
|
# units = CF::Run.add_units({:run_title => "title", :file => "path_of_file"})
|
data/lib/cf/station.rb
CHANGED
@@ -376,7 +376,7 @@ module CF
|
|
376
376
|
def badges badge = nil
|
377
377
|
line_title = line["title"] || line.title
|
378
378
|
if badge
|
379
|
-
if badge.settings[:test_attributes][:form_attributes].present?
|
379
|
+
if badge.settings[:test_attributes] && badge.settings[:test_attributes][:form_attributes].present?
|
380
380
|
form = badge.settings[:test_attributes][:form_attributes]
|
381
381
|
if( form[:type] == "CustomTaskForm" && form[:file])
|
382
382
|
raw_html = ""
|
data/lib/cf/version.rb
CHANGED
data/spec/badges_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe CF::Badge do
|
|
27
27
|
@badge = CF::Badge.create({
|
28
28
|
:line => line,
|
29
29
|
:station => s,
|
30
|
-
:name => "Tomb Digitizer#{Time.now}",
|
30
|
+
:name => "Tomb Digitizer#{Time.now.day}",
|
31
31
|
:description => "This badge qualifies you to work on tomb digitization tasks.",
|
32
32
|
:max_badges => 100,
|
33
33
|
:gold_standards => ["#{@gold_standard.settings[:name]}"],
|
@@ -42,6 +42,53 @@ describe CF::Badge do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should reuse the badge with in the account and badge to the station in DSL way" do
|
46
|
+
WebMock.allow_net_connect!
|
47
|
+
title = "line_title#{Time.new.strftime('%Y%b%d-%H%M%S')}".downcase
|
48
|
+
sleep 1
|
49
|
+
line = CF::Line.create(title,"Digitization") do |l|
|
50
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true, :valid_type => "general"})
|
51
|
+
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
52
|
+
end
|
53
|
+
station = CF::Station.create({:line => line, :type => "work"}) do |s|
|
54
|
+
CF::HumanWorker.new({:station => s, :number => 1, :reward => 10})
|
55
|
+
CF::TaskForm.create({:station => s, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
|
56
|
+
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
|
57
|
+
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
|
58
|
+
CF::FormField.new({:form => i, :label => "Last Name", :field_type => "short_answer", :required => "true"})
|
59
|
+
end
|
60
|
+
@gold_standard = CF::GoldStandard.new({ :line => line,
|
61
|
+
:station => s,
|
62
|
+
:name => "easy_#{Time.now}",
|
63
|
+
:input => {'image_url' => "http://onwired.com/images/portfolio/linda-stanley-business-card.jpg"},
|
64
|
+
:expected_output => {"first_name" => {"value" => "John"}, "last_name" => {"value" => "Lennon"}, "company" => {"value" => "Sprout"}}
|
65
|
+
})
|
66
|
+
|
67
|
+
@badge = CF::Badge.create({
|
68
|
+
:line => line,
|
69
|
+
:station => s,
|
70
|
+
:name => "timromero#{Time.now.day}",
|
71
|
+
:description => "This badge qualifies you to work on tomb digitization tasks.",
|
72
|
+
:max_badges => 100,
|
73
|
+
:gold_standards => ["#{@gold_standard.settings[:name]}"],
|
74
|
+
:test_attributes =>
|
75
|
+
{
|
76
|
+
:type => "default",
|
77
|
+
:retries => 10,
|
78
|
+
:pass_percentage => 100,
|
79
|
+
:check_manually => true
|
80
|
+
}
|
81
|
+
})
|
82
|
+
|
83
|
+
@badge = CF::Badge.create({
|
84
|
+
:line => line,
|
85
|
+
:station => s,
|
86
|
+
:name => "Tomb Digitizer#{Time.now.day}"
|
87
|
+
})
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
45
92
|
it "should add a badge to the station in plain ruby way" do
|
46
93
|
WebMock.allow_net_connect!
|
47
94
|
title = "line_title#{Time.new.strftime('%Y%b%d-%H%M%S')}".downcase
|
@@ -65,7 +112,7 @@ describe CF::Badge do
|
|
65
112
|
})
|
66
113
|
end
|
67
114
|
badge = CF::Badge.new({
|
68
|
-
:name => "Tomb
|
115
|
+
:name => "Tomb Digitizereee#{Time.now}",
|
69
116
|
:description => "This badge qualifies you to work on tomb digitization tasks.",
|
70
117
|
:max_badges => 100,
|
71
118
|
:gold_standards => ["#{@gold_standard.settings[:name]}"],
|
@@ -77,7 +124,14 @@ describe CF::Badge do
|
|
77
124
|
:check_manually => false
|
78
125
|
}
|
79
126
|
})
|
127
|
+
|
80
128
|
@line.stations.first.badges badge
|
129
|
+
badge1 = CF::Badge.new({
|
130
|
+
:name => "timromero#{Time.now.day}"
|
131
|
+
})
|
132
|
+
@line.stations.first.badges badge1
|
133
|
+
@line.stations.first.badges.count.should eql(2)
|
134
|
+
@line.stations.first.badges.last.settings["name"].should eql("timromero#{Time.now.day}")
|
81
135
|
@line.stations.first.badges.first.settings["name"].should eq(badge.settings[:name])
|
82
136
|
@line.stations.first.badges.first.settings['test']["form"].should eql({"_type"=>"TaskForm", "form_fields"=>[{"label"=>"First Name", "field_type"=>"short_answer", "required"=>true, "position"=>1}, {"label"=>"Middle Name", "field_type"=>"short_answer", "position"=>2}, {"label"=>"Last Name", "field_type"=>"short_answer", "required"=>true, "position"=>3}], "instruction"=>"Describe", "title"=>"Enter text from a business card image"})
|
83
137
|
|
data/spec/human_worker_spec.rb
CHANGED
@@ -15,7 +15,7 @@ module CF
|
|
15
15
|
end
|
16
16
|
line.stations.first.type.should eql("WorkStation")
|
17
17
|
line.stations.first.worker.number.should eql(1)
|
18
|
-
line.stations.first.worker.reward.should eql(20)
|
18
|
+
line.stations.first.worker.reward.should eql("20")
|
19
19
|
end
|
20
20
|
|
21
21
|
it "in block DSL way with invalid data and should set the error" do
|
data/spec/line_spec.rb
CHANGED
@@ -126,7 +126,7 @@ describe CF::Line do
|
|
126
126
|
line.input_formats.first.name.should eql("image_url")
|
127
127
|
line.stations.first.type.should eq("WorkStation")
|
128
128
|
line.stations.first.worker.number.should eq(1)
|
129
|
-
line.stations.first.worker.reward.should eq(20)
|
129
|
+
line.stations.first.worker.reward.should eq("20")
|
130
130
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
131
131
|
line.stations.first.form.instruction.should eq("Describe")
|
132
132
|
line.stations.first.form.form_fields.first.label.should eq("First Name")
|
@@ -258,7 +258,7 @@ describe CF::Line do
|
|
258
258
|
line.input_formats.first.name.should eql("image_url")
|
259
259
|
line.stations.first.type.should eq("WorkStation")
|
260
260
|
line.stations.first.worker.number.should eq(1)
|
261
|
-
line.stations.first.worker.reward.should eq(20)
|
261
|
+
line.stations.first.worker.reward.should eq("20")
|
262
262
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
263
263
|
line.stations.first.form.instruction.should eq("Describe")
|
264
264
|
line.stations.first.form.form_fields[0].label.should eq("First Name")
|
@@ -297,7 +297,7 @@ describe CF::Line do
|
|
297
297
|
line.stations.first.worker = worker
|
298
298
|
line.stations.first.type.should eql("WorkStation")
|
299
299
|
line.stations.first.worker.number.should eql(1)
|
300
|
-
line.stations.first.worker.reward.should eql(20)
|
300
|
+
line.stations.first.worker.reward.should eql("20")
|
301
301
|
end
|
302
302
|
|
303
303
|
it "should create a TaskForm within station" do
|
@@ -549,7 +549,7 @@ describe CF::Line do
|
|
549
549
|
line.input_formats.first.name.should eql("Company")
|
550
550
|
line.stations.first.type.should eq("WorkStation")
|
551
551
|
line.stations.first.worker.number.should eq(1)
|
552
|
-
line.stations.first.worker.reward.should eq(10)
|
552
|
+
line.stations.first.worker.reward.should eq("10")
|
553
553
|
line.output_formats.settings.should eql({:station_1 => [{:name => "First Name"}],:station_2 => [{:name => "Mobile", :except => true}]})
|
554
554
|
end
|
555
555
|
|
@@ -583,7 +583,7 @@ describe CF::Line do
|
|
583
583
|
line.input_formats.first.name.should eql("Company")
|
584
584
|
line.stations.first.type.should eq("WorkStation")
|
585
585
|
line.stations.first.worker.number.should eq(1)
|
586
|
-
line.stations.first.worker.reward.should eq(10)
|
586
|
+
line.stations.first.worker.reward.should eq("10")
|
587
587
|
line.output_formats.settings.should eql({:station_1 => [{:name => "First Name"}],:station_2 => [{:name => "Mobile", :except => true}]})
|
588
588
|
end
|
589
589
|
|
@@ -603,7 +603,7 @@ describe CF::Line do
|
|
603
603
|
line.input_formats.first.name.should eql("Company")
|
604
604
|
line.stations.first.type.should eq("WorkStation")
|
605
605
|
line.stations.first.worker.number.should eq(1)
|
606
|
-
line.stations.first.worker.reward.should eq(10)
|
606
|
+
line.stations.first.worker.reward.should eq("10")
|
607
607
|
line.output_formats.errors.should eql("Line is not complete or valid")
|
608
608
|
end
|
609
609
|
end
|
data/spec/run_spec.rb
CHANGED
@@ -30,7 +30,7 @@ module CF
|
|
30
30
|
line.stations[0].type.should eq("WorkStation")
|
31
31
|
|
32
32
|
line.stations[0].worker.number.should eq(1)
|
33
|
-
line.stations[0].worker.reward.should eq(20)
|
33
|
+
line.stations[0].worker.reward.should eq("20")
|
34
34
|
|
35
35
|
line.stations[0].form.title.should eq("Enter text from a business card image")
|
36
36
|
line.stations[0].form.instruction.should eq("Describe")
|
@@ -141,7 +141,7 @@ module CF
|
|
141
141
|
line.input_formats[1].required.should eq(true)
|
142
142
|
|
143
143
|
line.stations.first.worker.number.should eql(1)
|
144
|
-
line.stations.first.worker.reward.should eql(20)
|
144
|
+
line.stations.first.worker.reward.should eql("20")
|
145
145
|
|
146
146
|
line.stations.first.form.title.should eql("Enter text from a business card image")
|
147
147
|
line.stations.first.form.instruction.should eql("Describe")
|
data/spec/stat_badge_spec.rb
CHANGED
@@ -16,7 +16,7 @@ module CF
|
|
16
16
|
end
|
17
17
|
line.stations.first.type.should eql("WorkStation")
|
18
18
|
line.stations.first.worker.number.should eql(1)
|
19
|
-
line.stations.first.worker.reward.should eql(20)
|
19
|
+
line.stations.first.worker.reward.should eql("20")
|
20
20
|
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
21
21
|
end
|
22
22
|
|
@@ -37,7 +37,7 @@ module CF
|
|
37
37
|
|
38
38
|
line.stations.first.type.should eql("WorkStation")
|
39
39
|
line.stations.first.worker.number.should eql(1)
|
40
|
-
line.stations.first.worker.reward.should eql(20)
|
40
|
+
line.stations.first.worker.reward.should eql("20")
|
41
41
|
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
42
42
|
end
|
43
43
|
end
|
data/spec/station_spec.rb
CHANGED
@@ -30,7 +30,7 @@ describe CF::Station do
|
|
30
30
|
end
|
31
31
|
line.stations.first.type.should eq("WorkStation")
|
32
32
|
line.stations.first.worker.number.should eql(1)
|
33
|
-
line.stations.first.worker.reward.should eql(20)
|
33
|
+
line.stations.first.worker.reward.should eql("20")
|
34
34
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
35
35
|
line.stations.first.form.instruction.should eq("Describe")
|
36
36
|
line.stations.first.form.form_fields[0].label.should eq("First Name")
|
@@ -55,7 +55,7 @@ describe CF::Station do
|
|
55
55
|
end
|
56
56
|
line.stations.first.type.should eq("WorkStation")
|
57
57
|
line.stations.first.worker.number.should eql(1)
|
58
|
-
line.stations.first.worker.reward.should eql(20)
|
58
|
+
line.stations.first.worker.reward.should eql("20")
|
59
59
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
60
60
|
line.stations.first.form.instruction.should eq("Describe")
|
61
61
|
line.stations.first.form.form_fields[0].label.should eq("First Name")
|
@@ -79,7 +79,7 @@ describe CF::Station do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
line.stations.first.type.should eq("TournamentStation")
|
82
|
-
line.stations.first.jury_worker.should eql({"max_judges"=>10, "
|
82
|
+
line.stations.first.jury_worker.should eql({"max_judges"=>10, "tournament_restarts"=>0, "number"=>2})
|
83
83
|
line.stations.first.auto_judge.should eql({"enabled"=>true, "finalize_percentage"=>51})
|
84
84
|
line.stations.first.worker.number.should eql(3)
|
85
85
|
line.stations.first.worker.reward.should eql(20)
|
@@ -96,7 +96,7 @@ describe CF::Station do
|
|
96
96
|
sleep 1
|
97
97
|
line = CF::Line.new(title, "Digitization")
|
98
98
|
CF::InputFormat.new({:line => line, :name => "image_url", :required => true, :valid_type => "url"})
|
99
|
-
station = CF::Station.new({:type => "improve"})
|
99
|
+
station = CF::Station.new({:type => "improve"})
|
100
100
|
expect { line.stations station }.to raise_error(CF::ImproveStationNotAllowed)
|
101
101
|
end
|
102
102
|
|
@@ -123,7 +123,7 @@ describe CF::Station do
|
|
123
123
|
CF::HumanWorker.new({:station => s, :number => 2, :reward => 20})
|
124
124
|
end
|
125
125
|
end
|
126
|
-
line.stations.first.to_s.should eql("{:type => TournamentStation, :index => 1, :line_title => #{title}, :station_input_formats => , :jury_worker => {\"max_judges\"=>10,
|
126
|
+
line.stations.first.to_s.should eql("{:type => TournamentStation, :index => 1, :line_title => #{title}, :station_input_formats => , :jury_worker => {\"max_judges\"=>10, \"tournament_restarts\"=>0, \"number\"=>2}, auto_judge => {\"enabled\"=>true, \"finalize_percentage\"=>51}, :errors => }")
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -270,7 +270,7 @@ describe CF::Station do
|
|
270
270
|
line.stations.first.type.should eql("WorkStation")
|
271
271
|
line.stations.first.batch_size.should eql(3)
|
272
272
|
line.stations.first.worker.number.should eql(1)
|
273
|
-
line.stations.first.worker.reward.should eql(20)
|
273
|
+
line.stations.first.worker.reward.should eql("20")
|
274
274
|
end
|
275
275
|
|
276
276
|
it "for work station in Plain Ruby way" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cloudfactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- CloudFactory.com
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-01 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|