Skip to content

Commit

Permalink
Merge pull request #1765 from sparc-request/sry-adding_date_to_previo…
Browse files Browse the repository at this point in the history
…usly_sent_survey

SRY - Fixing survey latest sent date errors
  • Loading branch information
Stuart-Johnson committed Apr 5, 2019
2 parents eb30829 + 713c485 commit d538458
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/models/sub_service_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ def surveys_completed?
end

def survey_latest_sent_date
self.responses.joins(:survey).where(surveys: { type: 'SystemSurvey' }).first.updated_at
survey_response = self.responses.joins(:survey).where(surveys: { type: 'SystemSurvey' })
survey_response.any? ? survey_response.first.updated_at.try(:strftime, '%D') : 'N/A'
end

###############################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- if sub_service_request.is_complete? && !sub_service_request.surveys_completed?
%td.text-center
%span
= I18n.t('dashboard.sub_service_requests.tabs.request_details.options.last_sent', date: format_date(sub_service_request.survey_latest_sent_date))
= I18n.t('dashboard.sub_service_requests.tabs.request_details.options.last_sent', date: sub_service_request.survey_latest_sent_date)
%button.btn.btn-sm.btn-primary#resend-surveys-button{ data: { sub_service_request_id: sub_service_request.id } }
= t(:dashboard)[:sub_service_requests][:tabs][:request_details][:options][:resend_surveys]
- if !sub_service_request.in_work_fulfillment
Expand Down
2 changes: 1 addition & 1 deletion config/locales/dashboard.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ en:
send_to_epic: "Send to Epic"
core_approvals: "Administrative Approvals"
export_to_excel: "Export to Excel"
last_sent: "Surveys last sent on %{date}"
last_sent: "Survey last sent on: %{date}"
resend_surveys: "Resend Surveys"
delete_request: "Delete Request"
timeline:
Expand Down

0 comments on commit d538458

Please sign in to comment.