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 +4 -4
- data/.gitignore +2 -0
- data/lib/cellect/server/adapters/postgres.rb +16 -4
- data/lib/cellect/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0442b94ebaa41e617b478bd63a25e2db0e12934
|
4
|
+
data.tar.gz: bc98fabf0b03d863de24c3e4bd41965ff0801d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5f3612dd1dddb835cf6bf71e71315677af66913eacf66c7142abc1d5b5a57e6a2c79faa25eda0b641a0190bbe3cb693f9e58c7ece0ed0ec7d06f650edb151f
|
7
|
+
data.tar.gz: b9b32889cd3ebfc8b2b766715d721a7b0d735bf1a26a1ea91d1c62fe9d0ad520c0db7299837c7aafbfcb3423e157eb755af818176b30cd2ebc944dac96efd459
|
data/.gitignore
CHANGED
@@ -13,7 +13,7 @@ module Cellect
|
|
13
13
|
|
14
14
|
def workflow_list
|
15
15
|
with_pg do |pg|
|
16
|
-
pg.exec('
|
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
|
-
|
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
|
-
|
43
|
-
|
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
|
data/lib/cellect/version.rb
CHANGED