2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/workflow/project_owner_controller.rb', line 2
def index
@stories = {}
@tasks = {}
@vacancies = {}
@candidatures = {}
{ vacancies: Vacancy::STATES, candidatures: Candidature::STATES }.each do |controller, states|
query = 'offeror_id = :user_id'
query += ' OR author_id = :user_id' if controller == :vacancies
query = "(#{query}) AND state = :state"
states.each do |state|
collection = controller.to_s.classify.constantize.where(
query, user_id: current_user.id, state: state
).order('created_at DESC').limit(5)
eval("@#{controller}[state] = collection")
end
end
{ stories: [:completed, :active], tasks: [:under_supervision] }.each do |controller, states|
states.each do |state|
collection = controller.to_s.classify.constantize.where(
offeror_id: current_user.id, state: state
).limit(5)
eval("@#{controller}[state] = collection")
end
end
@twitter_sidenav_level = 2
end
|