lib/cellect/server/adapters/postgres.rb in cellect-server-0.0.1 vs lib/cellect/server/adapters/postgres.rb in cellect-server-0.0.2
- old
+ new
@@ -9,13 +9,13 @@
@pg ||= ConnectionPool.new(size: ENV.fetch('PG_POOL_SIZE', 25).to_i) do
PG.connect connection_options
end
end
- def project_list
+ def workflow_list
with_pg do |pg|
- pg.exec('select * from projects').collect do |row|
+ pg.exec('select * from workflows').collect do |row|
{
'id' => row['id'].to_i,
'name' => row['id'],
'prioritized' => row['prioritized'] == 't',
'pairwise' => row['pairwise'] == 't',
@@ -23,24 +23,24 @@
}
end
end
end
- def load_data_for(project_name)
+ def load_data_for(workflow_name)
with_pg do |pg|
- pg.exec("select id, priority, group_id from project_#{ project_name }_subjects").collect do |row|
+ pg.exec("select id, priority, group_id from workflow_#{ workflow_name }_subjects").collect do |row|
{
'id' => row['id'].to_i,
'priority' => row['priority'].to_f,
'group_id' => row['group_id'].to_i
}
end
end
end
- def load_user(project_name, id)
+ def load_user(workflow_name, id)
with_pg do |pg|
- pg.exec("select subject_id from project_#{ project_name }_classifications where user_id=#{ id }").collect do |row|
+ pg.exec("select subject_id from workflow_#{ workflow_name }_classifications where user_id=#{ id }").collect do |row|
row['subject_id'].to_i
end
end
end