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

Jw dashboard old questions #507

Merged
merged 3 commits into from
Jun 16, 2016
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions app/controllers/dashboard/protocols_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ def create
def edit
@protocol_type = @protocol.type
@permission_to_edit = @authorization.nil? ? false : @authorization.can_edit?
@protocol.populate_for_edit

if @permission_to_edit
@protocol.update_attribute(:study_type_question_group_id, StudyTypeQuestionGroup.active_id)
@protocol.study_type_question_group_id = StudyTypeQuestionGroup.active_id
end

@protocol.populate_for_edit

session[:breadcrumbs].
clear.
add_crumbs(protocol_id: @protocol.id, edit_protocol: true)
Expand Down
5 changes: 0 additions & 5 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@

add_index "identities", ["approved"], name: "index_identities_on_approved", using: :btree
add_index "identities", ["email"], name: "index_identities_on_email", using: :btree
add_index "identities", ["first_name", "last_name"], name: "full_name", type: :fulltext
add_index "identities", ["last_name"], name: "index_identities_on_last_name", using: :btree
add_index "identities", ["ldap_uid"], name: "index_identities_on_ldap_uid", unique: true, using: :btree
add_index "identities", ["reset_password_token"], name: "index_identities_on_reset_password_token", unique: true, using: :btree
Expand Down Expand Up @@ -1114,10 +1113,6 @@
add_index "tokens", ["identity_id"], name: "index_tokens_on_identity_id", using: :btree
add_index "tokens", ["service_request_id"], name: "index_tokens_on_service_request_id", using: :btree

create_table "user_notifications", force: :cascade do |t|
t.integer "identity_id", limit: 4
end

create_table "validation_conditions", force: :cascade do |t|
t.integer "validation_id", limit: 4
t.string "rule_key", limit: 255
Expand Down
10 changes: 4 additions & 6 deletions spec/controllers/dashboard/protocols/get_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@
expect(@protocol).to have_received(:populate_for_edit)
end

it "should update StudyTypeQuestionGroup id" do
expect(@protocol).to have_received(:update_attribute).
with(:study_type_question_group_id, active_study_type_question_group.id)
it "should set StudyTypeQuestionGroup id to activate" do
expect(@protocol.study_type_question_group_id).to eq(active_study_type_question_group.id)
end
it { is_expected.to respond_with :ok }
it { is_expected.to render_template "dashboard/protocols/edit" }
Expand Down Expand Up @@ -95,9 +94,8 @@
expect(@protocol).to have_received(:populate_for_edit)
end

it "should update StudyTypeQuestionGroup id" do
expect(@protocol).to have_received(:update_attribute).
with(:study_type_question_group_id, active_study_type_question_group.id)
it "should set StudyTypeQuestionGroup id to active" do
expect(@protocol.study_type_question_group_id).to eq(active_study_type_question_group.id)
end
it { is_expected.to respond_with :ok }
it { is_expected.to render_template "dashboard/protocols/edit" }
Expand Down