bumbleworks 0.0.68 → 0.0.69

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.
@@ -200,7 +200,11 @@ module Bumbleworks
200
200
  fields.each do |field, direction|
201
201
  sets = [wi_x['fields'], wi_y['fields']]
202
202
  sets.map! { |s| s['params'] } if field_type.to_s == 'params'
203
- result = sets[0][field.to_s] <=> sets[1][field.to_s]
203
+ wi_x_field, wi_y_field = sets[0][field.to_s], sets[1][field.to_s]
204
+ result = wi_x_field <=> wi_y_field
205
+ if result.nil?
206
+ result = wi_x_field.nil? ? 1 : -1
207
+ end
204
208
  relevant_direction = direction
205
209
  break if !result.zero?
206
210
  end
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.68"
2
+ VERSION = "0.0.69"
3
3
  end
@@ -226,6 +226,7 @@ describe Bumbleworks::Task do
226
226
  patient :task => 'panic', :priority => 2, :importance => 5
227
227
  nurse :task => 'roll_eyes', :priority => 4, :importance => 1000
228
228
  officer :task => 'appear_authoritative', :priority => 1, :importance => 1000
229
+ rhubarb :task => 'sit_quietly', :importance => 80
229
230
  end
230
231
  end
231
232
  end
@@ -243,13 +244,15 @@ describe Bumbleworks::Task do
243
244
  'appear_authoritative',
244
245
  'panic',
245
246
  'evince_concern',
246
- 'roll_eyes'
247
+ 'roll_eyes',
248
+ 'sit_quietly'
247
249
  ]
248
250
  end
249
251
 
250
252
  it 'can order in reverse' do
251
253
  tasks = described_class.order_by_param(:priority, :desc)
252
254
  tasks.map(&:nickname).should == [
255
+ 'sit_quietly',
253
256
  'roll_eyes',
254
257
  'evince_concern',
255
258
  'panic',
@@ -265,6 +268,7 @@ describe Bumbleworks::Task do
265
268
  'appear_authoritative',
266
269
  'evince_concern',
267
270
  'roll_eyes',
271
+ 'sit_quietly',
268
272
  'panic'
269
273
  ]
270
274
  end
@@ -281,6 +285,8 @@ describe Bumbleworks::Task do
281
285
  Bumbleworks.dashboard.wait_for(:officer)
282
286
  @wf4 = Bumbleworks.launch!('emergency_hamster_bullet', :group => 1, :strength => 4)
283
287
  Bumbleworks.dashboard.wait_for(:officer)
288
+ @wf5 = Bumbleworks.launch!('emergency_hamster_bullet', :group => 1)
289
+ Bumbleworks.dashboard.wait_for(:officer)
284
290
  end
285
291
 
286
292
  describe '.order_by_field' do
@@ -290,13 +296,15 @@ describe Bumbleworks::Task do
290
296
  ['evince_concern', @wf1.wfid],
291
297
  ['evince_concern', @wf2.wfid],
292
298
  ['evince_concern', @wf3.wfid],
293
- ['evince_concern', @wf4.wfid]
299
+ ['evince_concern', @wf4.wfid],
300
+ ['evince_concern', @wf5.wfid]
294
301
  ]
295
302
  end
296
303
 
297
304
  it 'can order in reverse' do
298
305
  tasks = described_class.for_role('doctor').order_by_field(:strength, :desc)
299
306
  tasks.map { |t| [t.nickname, t.wfid] }.should == [
307
+ ['evince_concern', @wf5.wfid],
300
308
  ['evince_concern', @wf4.wfid],
301
309
  ['evince_concern', @wf3.wfid],
302
310
  ['evince_concern', @wf2.wfid],
@@ -309,6 +317,7 @@ describe Bumbleworks::Task do
309
317
  it 'orders by multiple parameters' do
310
318
  tasks = described_class.for_role('doctor').order_by_fields(:group => :asc, :strength => :desc)
311
319
  tasks.map { |t| [t.nickname, t.wfid] }.should == [
320
+ ['evince_concern', @wf5.wfid],
312
321
  ['evince_concern', @wf4.wfid],
313
322
  ['evince_concern', @wf2.wfid],
314
323
  ['evince_concern', @wf3.wfid],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.68
4
+ version: 0.0.69
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -263,7 +263,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
263
  version: '0'
264
264
  segments:
265
265
  - 0
266
- hash: -2462957176367107392
266
+ hash: 3077608415877383800
267
267
  required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  none: false
269
269
  requirements:
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  version: '0'
273
273
  segments:
274
274
  - 0
275
- hash: -2462957176367107392
275
+ hash: 3077608415877383800
276
276
  requirements: []
277
277
  rubyforge_project:
278
278
  rubygems_version: 1.8.23