Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jl - epic current queue bug #1209

Merged
merged 1 commit into from
Dec 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions app/controllers/service_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,13 @@ def confirmation
@display_all_services = true

should_push_to_epic = @sub_service_request ? @sub_service_request.should_push_to_epic? : @service_request.should_push_to_epic?

if should_push_to_epic && Setting.find_by_key("use_epic").value && @protocol.selected_for_epic
# Send a notification to Lane et al to create users in Epic. Once
# that has been done, one of them will click a link which calls
# approve_epic_rights.
@protocol.ensure_epic_user
if Setting.find_by_key("queue_epic").value
EpicQueue.create(protocol_id: @protocol.id, identity_id: current_user.id) unless EpicQueue.where(protocol_id: @protocol.id).size == 1
EpicQueue.create(protocol_id: @protocol.id, identity_id: current_user.id) if should_queue_epic?(@protocol)
else
@protocol.awaiting_approval_for_epic_push
send_epic_notification_for_user_approval(@protocol)
Expand Down Expand Up @@ -443,4 +442,14 @@ def authorize_protocol_edit_request
def set_highlighted_link
@highlighted_link ||= 'sparc_request'
end

def should_queue_epic?(protocol)
queues = EpicQueue.where(protocol_id: protocol.id)
if (queues.size == 1)
queues.first.update_attributes(user_change: false)
return false
else
return true
end
end
end