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

ML - add info table to satisfaction survey email #1715

Merged
merged 3 commits into from
Feb 14, 2019
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
1 change: 1 addition & 0 deletions app/mailers/survey_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def service_survey(surveys, identity, ssr)
@identity = identity
@ssr = ssr
@surveys = surveys
@protocol = @ssr.protocol
email = @identity.email
subject = t('surveyor.responses.emails.service_survey.subject', site_name: t(:proper)[:header], ssr_id: @ssr.display_id)

Expand Down
52 changes: 52 additions & 0 deletions app/views/survey_notification/_info_table.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-# Copyright © 2011-2019 MUSC Foundation for Research Development~
-# All rights reserved.~

-# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~

-# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.~

-# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following~
-# disclaimer in the documentation and/or other materials provided with the distribution.~

-# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products~
-# derived from this software without specific prior written permission.~

-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,~
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT~
-# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL~
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS~
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR~
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.~

%table{:style => 'border: 1px solid #000; width: 100%; border-collapse: collapse;'}
%thead
%tr{:style => 'border: 1px solid black;'}
%td{:colspan => 2}
- if @protocol.type.capitalize == "Project"
%strong= t(:notifier)[:p_info]
- else
%strong= t(:notifier)[:study_info]
%tbody
%tr{:style => 'border: 1px solid black;'}
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:forms)[:table_fields][:srid]
%td{:style => 'border: 1px solid black;'}= @ssr.display_id

%tr{:style => 'border: 1px solid black;'}
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:notifier)[:title1]
%td{:style => 'border: 1px solid black;'}= @protocol.try(:short_title)

%tr{:style => 'border: 1px solid black;'}
- if @protocol.type.capitalize == "Project"
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:notifier)[:p_title]
- else
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:notifier)[:study_title]
%td{:style => 'border: 1px solid black;'}= @protocol.try(:title)

%tr{:style => 'border: 1px solid black;'}
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:surveyor)[:responses][:emails][:service_survey][:org_name]
%td{:style => 'border: 1px solid black;'}= @ssr.organization.name

%tr{:style => 'border: 1px solid black;'}
%th{:style => 'border: 1px solid black; width:200px; text-align:left;'}= t(:surveyor)[:responses][:table][:headers][:primary_pi]
%td{:style => 'border: 1px solid black;'}= @protocol.primary_principal_investigator.full_name

5 changes: 5 additions & 0 deletions app/views/survey_notification/service_survey.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@
%br
%em.gray-text
= raw(t(:surveyor)[:responses][:emails][:sctr_customer_satisfaction][:grant_info])

%br
%br

= render "info_table"
1 change: 1 addition & 0 deletions config/locales/surveyor.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ en:
text1: "Thank you for requesting services from"
text2: "The service(s) you requested have now been completed."
text3: "Please click on the link(s) below to complete the following survey(s) regarding the service(s) you received. Your feedback is important and appreciated!"
org_name: "Organization Name"
sctr_customer_satisfaction:
grant_reminder: "Please remember to cite the CTSA grant in any related publications:"
grant_info: "&quot;This publication [or project] was supported by the South Carolina Clinical & Translation Research (SCTR) Institute, with an academic home at the Medical University of South Carolina <strong class='din-gray-text'>NIH - NCATS Grant Number UL1 TR001450.</strong>&quot;"
Expand Down
8 changes: 8 additions & 0 deletions spec/mailers/survey_notification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
let(:identity) { create(:identity, email: 'nobody@nowhere.com') }
let(:org) { create(:organization) }
let(:ssr) { create(:sub_service_request_without_validations, organization: org) }
let(:protocol) { create(:protocol_without_validations, type: "Study")}
let(:service_request) { create(:service_request_without_validations, protocol: protocol)}
let(:ssr) { create(:sub_service_request_without_validations, organization: org, protocol: protocol, service_request: service_request) }
let(:pi) { create(:project_role, identity_id: identity.id, protocol: protocol) }

before :each do
pi.reload
end

describe 'system satisfaction survey' do
let(:survey) { create(:system_survey, title: "System Satisfaction survey", access_code: "system-satisfaction-survey") }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/sub_service_request/distribute_surveys_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
before :each do
@pi = create(:identity)
@service_requester = create(:identity)
@protocol = create(:protocol_without_validations)
@protocol = create(:protocol_without_validations, type: "Study")
create(:project_role, identity_id: @pi.id, protocol_id: @protocol.id, role: 'primary-pi')
@service_request = create(:service_request_without_validations, protocol: @protocol)
@organization = create(:organization)
Expand Down