cellect-server 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39f977e9ea6d66fa0e1f70111b258a54415e9b2d
4
- data.tar.gz: 3fb8918df55b6208c19326c4282a359304df7a1e
3
+ metadata.gz: a0442b94ebaa41e617b478bd63a25e2db0e12934
4
+ data.tar.gz: bc98fabf0b03d863de24c3e4bd41965ff0801d87
5
5
  SHA512:
6
- metadata.gz: e85979e0ec995c4e0d56a7185b5e711a2a3cf17f363a38ed0ce41cee73ed82a178e34a44833d8cf3ecc91b6470f965265276a06dafc47d1bcf4e89f25ee5309b
7
- data.tar.gz: f0c8ca0fc594993aa7791e96607cacc7b972ef7e2ae2543b527334c931f26db31ec4492dfab9af451919dc5227b82c97ed89770de11e93574ad4302d37eb8f7f
6
+ metadata.gz: 8c5f3612dd1dddb835cf6bf71e71315677af66913eacf66c7142abc1d5b5a57e6a2c79faa25eda0b641a0190bbe3cb693f9e58c7ece0ed0ec7d06f650edb151f
7
+ data.tar.gz: b9b32889cd3ebfc8b2b766715d721a7b0d735bf1a26a1ea91d1c62fe9d0ad520c0db7299837c7aafbfcb3423e157eb755af818176b30cd2ebc944dac96efd459
data/.gitignore CHANGED
@@ -13,3 +13,5 @@ log/*
13
13
  tmp/*
14
14
  *.gem
15
15
  pkg/*
16
+ *.swp
17
+ ext/
@@ -13,7 +13,7 @@ module Cellect
13
13
 
14
14
  def workflow_list
15
15
  with_pg do |pg|
16
- pg.exec('select * from workflows').collect do |row|
16
+ pg.exec('SELECT * FROM workflows').collect do |row|
17
17
  {
18
18
  'id' => row['id'].to_i,
19
19
  'name' => row['id'],
@@ -27,7 +27,15 @@ module Cellect
27
27
 
28
28
  def load_data_for(workflow_name)
29
29
  with_pg do |pg|
30
- pg.exec("select id, priority, group_id from workflow_#{ workflow_name }_subjects").collect do |row|
30
+ statement = <<-SQL
31
+ SELECT sms.id as id, sms.priority as priority, sms.subject_set_id as group_id
32
+ FROM workflows w
33
+ JOIN subject_sets_workflows ssw ON (ssw.workflow_id = w.id)
34
+ JOIN subject_sets ss ON (ss.id = ssw.subject_set_id)
35
+ JOIN set_member_subjects sms ON (s.id = sms.subject_set_id)
36
+ WHERE w.id = #{ workflow_name }
37
+ SQL
38
+ pg.exec(statement).collect do |row|
31
39
  {
32
40
  'id' => row['id'].to_i,
33
41
  'priority' => row['priority'].to_f,
@@ -39,8 +47,12 @@ module Cellect
39
47
 
40
48
  def load_user(workflow_name, id)
41
49
  with_pg do |pg|
42
- pg.exec("select subject_id from workflow_#{ workflow_name }_classifications where user_id=#{ id }").collect do |row|
43
- row['subject_id'].to_i
50
+ statement = <<-SQL
51
+ SELECT subject_ids FROM user_seen_subjects
52
+ WHERE user_id = #{ id } AND workflow_id = #{ workflow_name }
53
+ SQL
54
+ pg.exec(statement).collect do |row|
55
+ row['subject_ids'].map(&:to_i)
44
56
  end
45
57
  end
46
58
  end
@@ -1,3 +1,3 @@
1
1
  module Cellect
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellect-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish