cellect-server 3.0.1 → 3.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85b657bbeda0926ec4dac16bc70939070a85cc2f
4
- data.tar.gz: e40e23a68264fde408e87613314f2df097b2fda8
3
+ metadata.gz: 3f415bb15f193271a60d1b90e562844f4221e1bf
4
+ data.tar.gz: 84b53909f3af473976825fe4ed9104f19f1ccb5b
5
5
  SHA512:
6
- metadata.gz: 03a032d11d1c17279131a98b70c5936ea0b8217ed6736ba8719e6c506431369a7e2b0bc591301093515228c3188275868eff835b2f77a561b79eb4001f6ec521
7
- data.tar.gz: 3ac3642f79b1433e56f8e256c5e406f043f404454aa6100f5a75ce476324ba07fc3482316007d5722feef1c8fff8d0d71e367a981823d609518d3964232df5b1
6
+ metadata.gz: 611b8c5b12e11f55cfc640a01c6372cf4d448e35d96733c83494333369135304aafebd13979f74b1cce116c68f9dac0115ed242a6e328d9b0c672c7d453f7fd5
7
+ data.tar.gz: a66dbc7c5a19b497915521fa9d745f3c45418b3e044aa51098d369c499583d5b2e496613b27dfe30910c23e8071dc6d44f8f670e9762e9d0fe2fce81ef973ea8
@@ -2,9 +2,8 @@ language: ruby
2
2
  cache: bundler
3
3
 
4
4
  before_install:
5
- - sudo add-apt-repository ppa:boost-latest/ppa -y
6
5
  - sudo apt-get update -q
7
- - sudo apt-get install -y autoconf automake boost1.55 libffi-dev
6
+ - sudo apt-get install -y autoconf automake libboost1.55-dev libffi-dev
8
7
  - gem update bundler
9
8
 
10
9
  rvm:
@@ -12,9 +12,17 @@ module Cellect
12
12
  subjects
13
13
  end
14
14
 
15
- # Returns a group by id or samples one randomly with a fall back to a new group
15
+ # Returns a group by id
16
+ # if the group_id is supplied it will select or setup this group
17
+ # when no group_id is supplied, it attempts to select a random group
18
+ # finally if no loaded groupes it falls back to creating a new empty group
16
19
  def group(group_id = nil)
17
- subjects[group_id] || subjects.values.sample || fetch_or_setup_group(group_id)
20
+ group = if group_id
21
+ fetch_or_setup_group(group_id)
22
+ else
23
+ subjects.values.sample
24
+ end
25
+ group || fetch_or_setup_group(group_id)
18
26
  end
19
27
 
20
28
  # Get unseen subjects from a group for a user
@@ -1,3 +1,3 @@
1
1
  module Cellect
2
- VERSION = '3.0.1'
2
+ VERSION = '3.0.2'
3
3
  end
@@ -94,6 +94,12 @@ module Cellect::Server
94
94
  expect(workflow.group(1)).to receive(:subtract).with user.seen, 3
95
95
  workflow.sample user_id: 123, group_id: 1, limit: 3
96
96
  end
97
+
98
+ it 'should should select from an empty set if the group is not loaded' do
99
+ workflow.groups[0] = set_klass.new
100
+ expect(workflow.group(0)).not_to receive(:sample)
101
+ workflow.sample group_id: 1, limit: 3
102
+ end
97
103
  end
98
104
 
99
105
  describe "#add" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellect-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  version: '0'
327
327
  requirements: []
328
328
  rubyforge_project:
329
- rubygems_version: 2.5.1
329
+ rubygems_version: 2.6.14
330
330
  signing_key:
331
331
  specification_version: 4
332
332
  summary: ''