From 93b89b031537cf816975aeca7d32183c11d20141 Mon Sep 17 00:00:00 2001 From: Steven Meyers Date: Fri, 2 Oct 2020 19:06:04 -0500 Subject: [PATCH 1/5] Add court_report_submission CasaCaseDecorator method --- app/decorators/casa_case_decorator.rb | 4 ++++ spec/decorators/case_decorator_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 spec/decorators/case_decorator_spec.rb diff --git a/app/decorators/casa_case_decorator.rb b/app/decorators/casa_case_decorator.rb index 67b2bbc342..ed7546051d 100644 --- a/app/decorators/casa_case_decorator.rb +++ b/app/decorators/casa_case_decorator.rb @@ -9,6 +9,10 @@ def transition_aged_youth_only_icon object.transition_aged_youth ? "šŸ›šŸ¦‹" : "" end + def court_report_submission + object.court_report_submitted ? "Submitted" : "Not Submitted" + end + def case_contacts_ordered_by_occurred_at object.case_contacts.sort_by(&:occurred_at) end diff --git a/spec/decorators/case_decorator_spec.rb b/spec/decorators/case_decorator_spec.rb new file mode 100644 index 0000000000..23ad63c940 --- /dev/null +++ b/spec/decorators/case_decorator_spec.rb @@ -0,0 +1,22 @@ +require "rails_helper" + +RSpec.describe CasaCaseDecorator do + describe "#court_report_submission" do + context "when case_report_submitted is false" do + it "returns Not Submitted" do + casa_case = create(:casa_case) + + expect(casa_case.decorate.court_report_submission).to eq "Not Submitted" + end + end + + context "when duration_minutes is greater than 60" do + it "when court_report_submitted is true" do + casa_case = create(:casa_case) + casa_case.court_report_submitted = true + + expect(casa_case.decorate.court_report_submission).to eq "Submitted" + end + end + end +end From d3152d4a590dbd42e0c958706cdbb71c055b4d4a Mon Sep 17 00:00:00 2001 From: Steven Meyers Date: Fri, 2 Oct 2020 19:31:53 -0500 Subject: [PATCH 2/5] Add test for supervisor updating court report status --- spec/system/supervisor_edits_case_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/system/supervisor_edits_case_spec.rb b/spec/system/supervisor_edits_case_spec.rb index b33481d585..9f4d79f134 100644 --- a/spec/system/supervisor_edits_case_spec.rb +++ b/spec/system/supervisor_edits_case_spec.rb @@ -10,10 +10,12 @@ before do sign_in supervisor - visit edit_casa_case_path(casa_case) end it "edits case" do + visit casa_case_path(casa_case) + expect(page).to have_text("Court Report Submission: Not Submitted") + visit edit_casa_case_path(casa_case) has_no_checked_field? :court_report_submitted check "Court report submitted" check "Youth" @@ -21,5 +23,7 @@ has_checked_field? :court_report_submitted has_checked_field? "Youth" has_no_checked_field? "Supervisor" + visit casa_case_path(casa_case) + expect(page).to have_text("Court Report Submission: Submitted") end end From c422f1e4b540030c385e4d73d8aacd641c0e55a3 Mon Sep 17 00:00:00 2001 From: Steven Meyers Date: Fri, 2 Oct 2020 19:32:23 -0500 Subject: [PATCH 3/5] Add test for volunteer updating court report status --- spec/system/volunteer_edits_case_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/system/volunteer_edits_case_spec.rb b/spec/system/volunteer_edits_case_spec.rb index 5a86c8b300..1e5ecc2755 100644 --- a/spec/system/volunteer_edits_case_spec.rb +++ b/spec/system/volunteer_edits_case_spec.rb @@ -7,10 +7,10 @@ before do sign_in volunteer - visit edit_casa_case_path(casa_case) end it "clicks back button after editing case" do + visit edit_casa_case_path(casa_case) check "Court report submitted" click_on "Update CASA Case" @@ -22,9 +22,14 @@ end it "edits case" do + visit casa_case_path(casa_case) + expect(page).to have_text("Court Report Submission: Not Submitted") + visit edit_casa_case_path(casa_case) has_no_checked_field? :court_report_submitted check "Court report submitted" click_on "Update CASA Case" has_checked_field? :court_report_submitted + visit casa_case_path(casa_case) + expect(page).to have_text("Court Report Submission: Submitted") end end From f52b0ad59cb539734866cdd6c7d9e5dc33ad66c1 Mon Sep 17 00:00:00 2001 From: Steven Meyers Date: Fri, 2 Oct 2020 19:33:05 -0500 Subject: [PATCH 4/5] Use decorator to render court report status --- app/views/casa_cases/show.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/casa_cases/show.html.erb b/app/views/casa_cases/show.html.erb index cd57f35546..b46d8bc86e 100644 --- a/app/views/casa_cases/show.html.erb +++ b/app/views/casa_cases/show.html.erb @@ -22,6 +22,10 @@
Transition Aged Youth: <%= @casa_case.decorate.transition_aged_youth_icon %>

+

+

Court Report Submission: <%= @casa_case.decorate.court_report_submission %> +

+
Assigned Volunteers:
<% policy_scope(@casa_case.volunteers).each_with_index do |volunteer, index| %> From 43735de93eea28cde7a5d3c3dea74ecd7236b179 Mon Sep 17 00:00:00 2001 From: Steven Meyers Date: Fri, 2 Oct 2020 20:19:37 -0500 Subject: [PATCH 5/5] Run 3 cleanup linter tasks --- app/controllers/casa_admins_controller.rb | 3 ++- .../contact_type_groups_controller.rb | 17 ++++++------- app/controllers/contact_types_controller.rb | 5 ++-- app/controllers/imports_controller.rb | 12 +++++----- app/helpers/ui_helper.rb | 4 ++-- app/javascript/packs/application.js | 3 +-- app/javascript/src/case_contact.js | 24 +++++++++---------- app/javascript/src/sidebar.js | 10 ++++---- app/lib/importers/case_importer.rb | 19 +++++++-------- app/lib/importers/file_importer.rb | 10 ++++---- app/lib/importers/supervisor_importer.rb | 18 +++++++------- app/lib/importers/volunteer_importer.rb | 2 +- app/models/casa_case.rb | 10 ++++---- app/models/case_contact.rb | 6 +++-- app/models/contact_type.rb | 2 +- app/models/user.rb | 2 +- app/policies/casa_case_policy.rb | 2 +- .../all_casa_admins/dashboard/show.html.erb | 4 ++-- .../casa_admin_mailer/account_setup.html.erb | 1 - app/views/casa_cases/_form.html.erb | 2 +- .../casa_cases/_volunteer_assignment.html.erb | 2 +- app/views/casa_cases/index.html.erb | 2 +- .../case_contacts/_case_contact.html.erb | 6 ++--- .../_confirm_note_content_dialog.html.erb | 2 +- app/views/case_contacts/_form.html.erb | 2 -- app/views/case_contacts/index.html.erb | 2 +- .../mailer/invitation_instructions.html.erb | 4 ++-- app/views/imports/_cases.html.erb | 3 +-- app/views/imports/_supervisors.html.erb | 2 +- app/views/imports/_volunteers.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- .../layouts/footers/_not_logged_in.html.erb | 2 +- app/views/supervisors/index.html.erb | 2 +- app/views/volunteers/index.html.erb | 2 +- ...308_link_case_contacts_to_contact_types.rb | 2 +- .../decorators/case_contact_decorator_spec.rb | 4 ++-- spec/factories/casa_org.rb | 2 +- spec/helpers/application_helper_spec.rb | 4 ++-- spec/lib/importers/file_importer_spec.rb | 2 +- spec/models/casa_case_spec.rb | 2 +- spec/models/case_contact_spec.rb | 2 +- .../case_contact_policy_spec.rb | 4 ++-- spec/requests/casa_admins_spec.rb | 6 ++--- spec/requests/casa_cases_spec.rb | 8 +++---- spec/requests/case_contacts_spec.rb | 2 +- spec/requests/contact_type_groups_spec.rb | 4 ++-- spec/requests/contact_type_spec.rb | 4 ++-- spec/requests/imports_request_spec.rb | 6 ++--- spec/support/capybara.rb | 10 ++++---- spec/support/pundit_helper.rb | 2 +- spec/system/creating_casa_admins_spec.rb | 1 - spec/system/supervisor_edits_case_spec.rb | 2 +- .../volunteer_adds_a_case_contact_spec.rb | 2 +- .../case_contacts/index.html.erb_spec.rb | 2 +- spec/views/dashboard/show.html.erb_spec.rb | 1 - 55 files changed, 128 insertions(+), 135 deletions(-) diff --git a/app/controllers/casa_admins_controller.rb b/app/controllers/casa_admins_controller.rb index 1cdd1f6564..2623a26f9a 100644 --- a/app/controllers/casa_admins_controller.rb +++ b/app/controllers/casa_admins_controller.rb @@ -7,7 +7,8 @@ def index @admins = policy_scope(current_organization.casa_admins) end - def edit; end + def edit + end def update if @casa_admin.update(update_casa_admin_params) diff --git a/app/controllers/contact_type_groups_controller.rb b/app/controllers/contact_type_groups_controller.rb index fa5d5bc4ca..5df7765f2c 100644 --- a/app/controllers/contact_type_groups_controller.rb +++ b/app/controllers/contact_type_groups_controller.rb @@ -16,7 +16,8 @@ def create end end - def edit; end + def edit + end def update if @contact_type_group.update(contact_type_group_params) @@ -26,13 +27,13 @@ def update end end -private + private - def contact_type_group_params - params.require(:contact_type_group).permit(:name, :active) - end + def contact_type_group_params + params.require(:contact_type_group).permit(:name, :active) + end - def set_contact_type_group - @contact_type_group = ContactTypeGroup.find(params[:id]) - end + def set_contact_type_group + @contact_type_group = ContactTypeGroup.find(params[:id]) + end end diff --git a/app/controllers/contact_types_controller.rb b/app/controllers/contact_types_controller.rb index 612c5fe26e..d9690fd279 100644 --- a/app/controllers/contact_types_controller.rb +++ b/app/controllers/contact_types_controller.rb @@ -19,7 +19,8 @@ def create end end - def edit; end; + def edit + end def update if @contact_type.update(contact_type_params) @@ -29,7 +30,7 @@ def update end end -private + private def set_group_options @group_options = ContactTypeGroup.for_organization(current_organization).collect { |group| [group.name, group.id] } diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 554a0f392d..bea0ea5cf5 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -16,7 +16,7 @@ def create # If there were failed imports if import[:exported_rows] - message << "

" + link_to("Click here to download failed rows.", download_failed_imports_path) + + message << "

" + link_to("Click here to download failed rows.", download_failed_imports_path) + "

" + "

#{ERR_FAILED_IMPORT_NOTE}

" session[:exported_rows] = import[:exported_rows] end @@ -51,7 +51,7 @@ def header { "volunteer" => VolunteerImporter::IMPORT_HEADER, "supervisor" => SupervisorImporter::IMPORT_HEADER, - "casa_case" => CaseImporter::IMPORT_HEADER, + "casa_case" => CaseImporter::IMPORT_HEADER } end @@ -98,10 +98,10 @@ def validate_file(file, import_type) unless header_valid?(file_header, import_type) message = "#{ERR_INVALID_HEADER}

" \ - "Expected Header: #{header[import_type].to_s}.

" \ - "

Received Header: #{file_header.to_s}

" - - return {type: :error, message: message} + "Expected Header: #{header[import_type]}.

" \ + "

Received Header: #{file_header}

" + + {type: :error, message: message} end end end diff --git a/app/helpers/ui_helper.rb b/app/helpers/ui_helper.rb index 282b79a3d0..599ec5f0a4 100644 --- a/app/helpers/ui_helper.rb +++ b/app/helpers/ui_helper.rb @@ -9,13 +9,13 @@ def grouped_options_for_assigning_case(volunteer) "Not Assigned", CasaCase .not_assigned(@volunteer.casa_org) - .map{ |casa_case| [casa_case.case_number, casa_case.id] } + .map { |casa_case| [casa_case.case_number, casa_case.id] } ], [ "Assigned", CasaCase .actively_assigned_excluding_volunteer(@volunteer) - .map{ |casa_case| [casa_case.case_number, casa_case.id] } + .map { |casa_case| [casa_case.case_number, casa_case.id] } ] ] end diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9ca27e813e..527215a590 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -6,9 +6,9 @@ // this is how stylesheets are loaded into the running application import 'src/stylesheets/application.scss' - import 'bootstrap' import 'bootstrap-select' +import Select2 from 'select2' require('@rails/ujs').start() require('@rails/activestorage').start() require('channels') @@ -16,7 +16,6 @@ require('jquery') require('bootstrap-datepicker') require('datatables.net-dt') require('datatables.net-dt/css/jquery.dataTables.css') -import Select2 from 'select2' require('select2') require('select2/dist/css/select2') diff --git a/app/javascript/src/case_contact.js b/app/javascript/src/case_contact.js index 304fca5dca..0a003fdbeb 100644 --- a/app/javascript/src/case_contact.js +++ b/app/javascript/src/case_contact.js @@ -70,29 +70,29 @@ window.onload = function () { } function validateNoteContent (e) { - const note_content = document.getElementById('case_contact_notes').value; + const note_content = document.getElementById('case_contact_notes').value if (note_content != '') { - e.preventDefault(); - $('#confirm-submit').modal('show'); - document.getElementById('note-content').innerHTML = note_content; + e.preventDefault() + $('#confirm-submit').modal('show') + document.getElementById('note-content').innerHTML = note_content } } - $('#casa-contact-form').submit(function(e) { + $('#casa-contact-form').submit(function (e) { validateNoteContent(e) - }); + }) - $("#confirm-submit").on("focus", function () { - document.getElementById('modal-case-contact-submit').disabled = false; - }); + $('#confirm-submit').on('focus', function () { + document.getElementById('modal-case-contact-submit').disabled = false + }) - $("#confirm-submit").on("hide.bs.modal", function () { + $('#confirm-submit').on('hide.bs.modal', function () { caseContactSubmit.disabled = false - }); + }) const caseContactSubmitFromModal = document.getElementById('modal-case-contact-submit') caseContactSubmitFromModal.onclick = function () { - $('#casa-contact-form').unbind("submit"); + $('#casa-contact-form').unbind('submit') } caseContactSubmit.onclick = function (e) { diff --git a/app/javascript/src/sidebar.js b/app/javascript/src/sidebar.js index 0062476fdb..ede772ec31 100644 --- a/app/javascript/src/sidebar.js +++ b/app/javascript/src/sidebar.js @@ -1,13 +1,13 @@ /* global $ */ -function toggleSidebar() { - const isOpen = $( "#sidebar-js" ).hasClass( "sidebar-open" ); +function toggleSidebar () { + const isOpen = $('#sidebar-js').hasClass('sidebar-open') if (isOpen) { - $('#sidebar-js').removeClass('sidebar-open'); + $('#sidebar-js').removeClass('sidebar-open') } else { - $('#sidebar-js').addClass('sidebar-open'); + $('#sidebar-js').addClass('sidebar-open') } } $('document').ready(() => { - $('#toggle-sidebar-js, #sidebar-js').on("click", toggleSidebar); + $('#toggle-sidebar-js, #sidebar-js').on('click', toggleSidebar) }) diff --git a/app/lib/importers/case_importer.rb b/app/lib/importers/case_importer.rb index 959c2b88c7..2c18af4909 100644 --- a/app/lib/importers/case_importer.rb +++ b/app/lib/importers/case_importer.rb @@ -19,15 +19,13 @@ def import_cases failures << "Case #{case_number} already exists" if result[:existing] volunteers = email_addresses_to_users(Volunteer, String(row[:case_assignment])) volunteers.each do |volunteer| - begin - if volunteer.casa_cases.exists?(casa_case.id) - failures << "Volunteer #{volunteer.email} already assigned to #{case_number}" - else - casa_case.volunteers << volunteer - end - rescue StandardError => error - failures << error.to_s + if volunteer.casa_cases.exists?(casa_case.id) + failures << "Volunteer #{volunteer.email} already assigned to #{case_number}" + else + casa_case.volunteers << volunteer end + rescue => error + failures << error.to_s end raise failures.join("\n") unless failures.empty? @@ -35,18 +33,17 @@ def import_cases end end - private def create_casa_case(row_data) casa_case_params = row_data.to_hash.slice(:case_number, :transition_aged_youth, :birth_month_year_youth) casa_case = CasaCase.find_by(casa_case_params) - return { casa_case: casa_case, existing: true } if casa_case.present? + return {casa_case: casa_case, existing: true} if casa_case.present? casa_case = CasaCase.new(casa_case_params) casa_case.casa_org_id = org_id casa_case.save! - { casa_case: casa_case, existing: false } + {casa_case: casa_case, existing: false} end end diff --git a/app/lib/importers/file_importer.rb b/app/lib/importers/file_importer.rb index 0fb708560e..d6cd334973 100644 --- a/app/lib/importers/file_importer.rb +++ b/app/lib/importers/file_importer.rb @@ -23,7 +23,7 @@ def import @file_no_rows = false yield(row) @number_imported += 1 - rescue StandardError => error + rescue => error # email for supervisor or volunteer # display name for supervisor or volunteer # case number for casa_case @@ -41,14 +41,14 @@ def import } end -private + private def failed? !failed_imports.blank? end def success? - !failed? && !@file_no_rows + !failed? && !@file_no_rows end def message @@ -86,12 +86,12 @@ def email_addresses_to_users(clazz, comma_separated_emails) def create_user_record(user_class, row_data) user_params = row_data.to_hash.slice(:display_name, :email) user = user_class.find_by(user_params) - return { user: user, existing: true } if user.present? + return {user: user, existing: true} if user.present? user = user_class.new(user_params) user.casa_org_id, user.password = org_id, SecureRandom.hex(10) user.save! user.invite! - { user: user, existing: false } + {user: user, existing: false} end end diff --git a/app/lib/importers/supervisor_importer.rb b/app/lib/importers/supervisor_importer.rb index 955a329a8b..3350914adc 100644 --- a/app/lib/importers/supervisor_importer.rb +++ b/app/lib/importers/supervisor_importer.rb @@ -1,6 +1,6 @@ class SupervisorImporter < FileImporter IMPORT_HEADER = ["email", "display_name", "supervisor_volunteers"] - + def self.import_supervisors(csv_filespec, org_id) new(csv_filespec, org_id).import_supervisors end @@ -17,17 +17,15 @@ def import_supervisors failures = [] failures << "Supervisor #{supervisor.email} already exists" if result[:existing] email_addresses_to_users(Volunteer, String(row[:supervisor_volunteers])).each do |volunteer| - begin - if volunteer.supervisor - next if volunteer.supervisor == supervisor + if volunteer.supervisor + next if volunteer.supervisor == supervisor - failures << "Volunteer #{volunteer.email} already has a supervisor" - else - supervisor.volunteers << volunteer - end - rescue StandardError => error - failures << error.to_s + failures << "Volunteer #{volunteer.email} already has a supervisor" + else + supervisor.volunteers << volunteer end + rescue => error + failures << error.to_s end end diff --git a/app/lib/importers/volunteer_importer.rb b/app/lib/importers/volunteer_importer.rb index ec945c4752..d8fda509fa 100644 --- a/app/lib/importers/volunteer_importer.rb +++ b/app/lib/importers/volunteer_importer.rb @@ -1,6 +1,6 @@ class VolunteerImporter < FileImporter IMPORT_HEADER = ["display_name", "email"] - + def self.import_volunteers(csv_filespec, org_id) new(csv_filespec, org_id).import_volunteers end diff --git a/app/models/casa_case.rb b/app/models/casa_case.rb index f44404fd01..4142f7fd75 100644 --- a/app/models/casa_case.rb +++ b/app/models/casa_case.rb @@ -17,16 +17,16 @@ class CasaCase < ApplicationRecord case_assignments: {volunteer: volunteer, is_active: true} ) } - scope :actively_assigned_excluding_volunteer, -> (volunteer) { + scope :actively_assigned_excluding_volunteer, ->(volunteer) { joins(:case_assignments) - .where(case_assignments: { is_active: true }) - .where.not(case_assignments: { volunteer: volunteer }) + .where(case_assignments: {is_active: true}) + .where.not(case_assignments: {volunteer: volunteer}) .order(:case_number) } - scope :not_assigned, -> (casa_org) { + scope :not_assigned, ->(casa_org) { where(casa_org_id: casa_org.id) .left_outer_joins(:case_assignments) - .where(case_assignments: { id: nil }) + .where(case_assignments: {id: nil}) .order(:case_number) } diff --git a/app/models/case_contact.rb b/app/models/case_contact.rb index 3725516be6..6890d26f93 100644 --- a/app/models/case_contact.rb +++ b/app/models/case_contact.rb @@ -42,8 +42,10 @@ class CaseContact < ApplicationRecord where(want_driving_reimbursement: want_driving_reimbursement) if want_driving_reimbursement == true || want_driving_reimbursement == false } scope :contact_type, ->(contact_type = nil) { - joins(:db_contact_types) - .where("contact_types.name in (?)", contact_type) if contact_type.present? + if contact_type.present? + joins(:db_contact_types) + .where("contact_types.name in (?)", contact_type) + end } IN_PERSON = "in-person".freeze diff --git a/app/models/contact_type.rb b/app/models/contact_type.rb index a2e37ada09..bfd03c89d3 100644 --- a/app/models/contact_type.rb +++ b/app/models/contact_type.rb @@ -5,7 +5,7 @@ class ContactType < ApplicationRecord scope :for_organization, ->(org) { joins(:contact_type_group) - .where(contact_type_groups: { casa_org: org }) + .where(contact_type_groups: {casa_org: org}) } end diff --git a/app/models/user.rb b/app/models/user.rb index 415c1af067..a02c11b7f7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -84,7 +84,7 @@ def no_contact_for_two_weeks # Get ACTIVE volunteers that have ACTIVE supervisor assignments with at least one ACTIVE case # 1st condition: Volunteer has not created a contact AT ALL within the past 14 days # 2nd condition: Volunteer has ONLY created contacts in which contact_made = false within the past 14 days - + volunteers .includes(:case_assignments) .joins("LEFT JOIN case_contacts cc on cc.creator_id = users.id AND cc.occurred_at > (CURRENT_DATE - INTERVAL '14 days')") diff --git a/app/policies/casa_case_policy.rb b/app/policies/casa_case_policy.rb index 8f554d71d9..42f2799032 100644 --- a/app/policies/casa_case_policy.rb +++ b/app/policies/casa_case_policy.rb @@ -41,7 +41,7 @@ def assign_volunteers? def permitted_attributes common_attrs = [ :court_report_submitted, - casa_case_contact_types_attributes: [:contact_type_id], + casa_case_contact_types_attributes: [:contact_type_id] ] case @user diff --git a/app/views/all_casa_admins/dashboard/show.html.erb b/app/views/all_casa_admins/dashboard/show.html.erb index 2ef7e11757..a59087607d 100644 --- a/app/views/all_casa_admins/dashboard/show.html.erb +++ b/app/views/all_casa_admins/dashboard/show.html.erb @@ -1,7 +1,7 @@
@@ -24,4 +24,4 @@
-
\ No newline at end of file + diff --git a/app/views/casa_admin_mailer/account_setup.html.erb b/app/views/casa_admin_mailer/account_setup.html.erb index 4dd40fb97f..646087fb64 100644 --- a/app/views/casa_admin_mailer/account_setup.html.erb +++ b/app/views/casa_admin_mailer/account_setup.html.erb @@ -16,4 +16,3 @@ - diff --git a/app/views/casa_cases/_form.html.erb b/app/views/casa_cases/_form.html.erb index b236cde329..51ff9bee54 100644 --- a/app/views/casa_cases/_form.html.erb +++ b/app/views/casa_cases/_form.html.erb @@ -16,7 +16,7 @@
<%= form.label :birth_month_year_youth, "Youth's Birth Month & Year" %>
- <%= form.date_select :birth_month_year_youth, {order: [:month, :year], start_year: Date.current.year, end_year: 1989, prompt: {month: 'Month', year: 'Year'}, discard_day: true }, class: "select2 date-input"%> + <%= form.date_select :birth_month_year_youth, {order: [:month, :year], start_year: Date.current.year, end_year: 1989, prompt: {month: 'Month', year: 'Year'}, discard_day: true }, class: "select2 date-input" %>
<% end %> diff --git a/app/views/casa_cases/_volunteer_assignment.html.erb b/app/views/casa_cases/_volunteer_assignment.html.erb index b90ea407c1..76de42998a 100644 --- a/app/views/casa_cases/_volunteer_assignment.html.erb +++ b/app/views/casa_cases/_volunteer_assignment.html.erb @@ -80,4 +80,4 @@ <%= form.submit 'Assign Volunteer', class: 'btn btn-secondary' %> <% end %> - \ No newline at end of file + diff --git a/app/views/casa_cases/index.html.erb b/app/views/casa_cases/index.html.erb index 1dd4b5c272..0bcaa34b39 100644 --- a/app/views/casa_cases/index.html.erb +++ b/app/views/casa_cases/index.html.erb @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/app/views/case_contacts/_case_contact.html.erb b/app/views/case_contacts/_case_contact.html.erb index b493179a4e..363bc532eb 100644 --- a/app/views/case_contacts/_case_contact.html.erb +++ b/app/views/case_contacts/_case_contact.html.erb @@ -20,7 +20,7 @@ Miles Driven <%= contact.decorate.miles_traveled %> <% unless contact.decorate.miles_traveled.blank? %> - <%= " "%> + <%= " " %> <% end %> @@ -37,7 +37,7 @@ <%= link_to "#{contact.creator&.display_name} ", edit_users_path %> <% else %> <%= link_to "#{contact.creator&.display_name} ", edit_volunteer_path(contact.creator) %> - <%end%> + <% end %> <% else %> <%= contact.creator&.display_name %> <% end %> @@ -50,4 +50,4 @@ <% end %> - \ No newline at end of file + diff --git a/app/views/case_contacts/_confirm_note_content_dialog.html.erb b/app/views/case_contacts/_confirm_note_content_dialog.html.erb index f08be788dc..a280ce702b 100644 --- a/app/views/case_contacts/_confirm_note_content_dialog.html.erb +++ b/app/views/case_contacts/_confirm_note_content_dialog.html.erb @@ -18,4 +18,4 @@ - \ No newline at end of file + diff --git a/app/views/case_contacts/_form.html.erb b/app/views/case_contacts/_form.html.erb index 6f8e6f0484..9988707f06 100644 --- a/app/views/case_contacts/_form.html.erb +++ b/app/views/case_contacts/_form.html.erb @@ -138,5 +138,3 @@ <%= render 'confirm_note_content_dialog', form: form %> <% end %> - - diff --git a/app/views/case_contacts/index.html.erb b/app/views/case_contacts/index.html.erb index 3378a78e9d..a1eb4002ce 100644 --- a/app/views/case_contacts/index.html.erb +++ b/app/views/case_contacts/index.html.erb @@ -31,5 +31,5 @@ -
+
<% end %> diff --git a/app/views/devise/mailer/invitation_instructions.html.erb b/app/views/devise/mailer/invitation_instructions.html.erb index 724f4931e8..74ff8edbe9 100644 --- a/app/views/devise/mailer/invitation_instructions.html.erb +++ b/app/views/devise/mailer/invitation_instructions.html.erb @@ -2,12 +2,12 @@ diff --git a/app/views/imports/_cases.html.erb b/app/views/imports/_cases.html.erb index ce59cc6c0d..5d7f5b161b 100644 --- a/app/views/imports/_cases.html.erb +++ b/app/views/imports/_cases.html.erb @@ -23,7 +23,7 @@ <%= f.file_field :file, id: 'case-file', accept: 'text/csv', class: 'form-control-file', style: "margin: auto;" %> -<%= button_tag id: "case-import-button", class: "btn btn-md btn-success pull-right", +<%= button_tag id: "case-import-button", class: "btn btn-md btn-success pull-right", disabled: true, data: { disable_with: " Importing File"} do %> Import Cases CSV <% end %> @@ -34,4 +34,3 @@ }); <% end %> - diff --git a/app/views/imports/_supervisors.html.erb b/app/views/imports/_supervisors.html.erb index 9ac1f8c260..755fe2d921 100644 --- a/app/views/imports/_supervisors.html.erb +++ b/app/views/imports/_supervisors.html.erb @@ -23,7 +23,7 @@ <%= f.file_field :file, id: 'supervisor-file', accept: 'text/csv', class: 'form-control-file', style: "margin: auto;" %> -<%= button_tag id: "supervisor-import-button", class: "btn btn-md btn-success pull-right", +<%= button_tag id: "supervisor-import-button", class: "btn btn-md btn-success pull-right", disabled: true, data: { disable_with: " Importing File"} do %> Import Supervisors CSV <% end %> diff --git a/app/views/imports/_volunteers.html.erb b/app/views/imports/_volunteers.html.erb index 2194a8a68b..1a33f7ebb4 100644 --- a/app/views/imports/_volunteers.html.erb +++ b/app/views/imports/_volunteers.html.erb @@ -23,7 +23,7 @@ <%= f.file_field :file, id: 'volunteer-file', accept: 'text/csv', class: 'form-control-file', style: "margin: auto;" %> -<%= button_tag id: "volunteer-import-button", class: "btn btn-md btn-success pull-right", +<%= button_tag id: "volunteer-import-button", class: "btn btn-md btn-success pull-right", disabled: true, data: { disable_with: " Importing File"} do %> Import Volunteers CSV <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 69093eeeab..94058c84d7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,7 +27,7 @@ <%= render 'layouts/flash_messages' %> <%= yield %> <%= render 'layouts/footers/not_logged_in' %> - <% end%> + <% end %> diff --git a/app/views/layouts/footers/_not_logged_in.html.erb b/app/views/layouts/footers/_not_logged_in.html.erb index cdb2509970..dfc341b390 100644 --- a/app/views/layouts/footers/_not_logged_in.html.erb +++ b/app/views/layouts/footers/_not_logged_in.html.erb @@ -1,5 +1,5 @@
- A CASA/Prince George’s County <%=@resource.type%> console account has been created for you. This console is for logging the time you spend and actions you take on your CASA case. You can log activity with your CASA youth, their family members, their foster family or placement, the DSS worker, your Case Supervisor and others associated with your CASA case (such as teachers and therapists). + A CASA/Prince George’s County <%= @resource.type %> console account has been created for you. This console is for logging the time you spend and actions you take on your CASA case. You can log activity with your CASA youth, their family members, their foster family or placement, the DSS worker, your Case Supervisor and others associated with your CASA case (such as teachers and therapists).
- Your console account is associated with this email. If this is not the correct email to use, please stop here and contact your Case Supervisor to change the email address. If you are ready to get started, please set your password. This is the first step to accessing your new <%=@resource.type%> account. + Your console account is associated with this email. If this is not the correct email to use, please stop here and contact your Case Supervisor to change the email address. If you are ready to get started, please set your password. This is the first step to accessing your new <%= @resource.type %> account.
- \ No newline at end of file + diff --git a/app/views/volunteers/index.html.erb b/app/views/volunteers/index.html.erb index bae053de7b..2463ec5aab 100644 --- a/app/views/volunteers/index.html.erb +++ b/app/views/volunteers/index.html.erb @@ -144,4 +144,4 @@ - \ No newline at end of file + diff --git a/db/migrate/20200922170308_link_case_contacts_to_contact_types.rb b/db/migrate/20200922170308_link_case_contacts_to_contact_types.rb index 3ea305af89..1948f4670b 100644 --- a/db/migrate/20200922170308_link_case_contacts_to_contact_types.rb +++ b/db/migrate/20200922170308_link_case_contacts_to_contact_types.rb @@ -20,7 +20,7 @@ def change social_worker: ContactType.where(name: "Social Worker").first, supervisor: ContactType.where(name: "Supervisor").first, therapist: ContactType.where(name: "Therapist").first, - youth: ContactType.where(name: "Youth").first, + youth: ContactType.where(name: "Youth").first } # Point case_contact to contact_types diff --git a/spec/decorators/case_contact_decorator_spec.rb b/spec/decorators/case_contact_decorator_spec.rb index 6a62d543a0..449b921da1 100644 --- a/spec/decorators/case_contact_decorator_spec.rb +++ b/spec/decorators/case_contact_decorator_spec.rb @@ -56,7 +56,7 @@ [ build(:contact_type, name: "School"), build(:contact_type, name: "Therapist"), - build(:contact_type, name: "Bio Parent"), + build(:contact_type, name: "Bio Parent") ] end @@ -67,7 +67,7 @@ let(:db_contact_types) do [ build(:contact_type, name: "School"), - build(:contact_type, name: "Therapist"), + build(:contact_type, name: "Therapist") ] end diff --git a/spec/factories/casa_org.rb b/spec/factories/casa_org.rb index f8621de7ec..2c9835c060 100644 --- a/spec/factories/casa_org.rb +++ b/spec/factories/casa_org.rb @@ -2,7 +2,7 @@ factory :casa_org do sequence(:name) { |n| "CASA Org #{n}" } sequence(:display_name) { |n| "CASA Org #{n}" } - address { "123 Main St"} + address { "123 Main St" } footer_links { [["www.example.com", "First Link"], ["www.foobar.com", "Second Link"]] } end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 8ffdc4e261..a052c400a4 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -2,7 +2,7 @@ describe ApplicationHelper, type: :helper do describe "#page_header" do - it "links to the user dashboard if user logged in" do + it "links to the user dashboard if user logged in" do current_organization = build_stubbed(:casa_org) user = build_stubbed(:user, casa_org: current_organization) @@ -35,4 +35,4 @@ expect(helper.session_link).to match(new_user_session_path) end end -end \ No newline at end of file +end diff --git a/spec/lib/importers/file_importer_spec.rb b/spec/lib/importers/file_importer_spec.rb index 9409d19d45..046e88d6e8 100644 --- a/spec/lib/importers/file_importer_spec.rb +++ b/spec/lib/importers/file_importer_spec.rb @@ -40,7 +40,7 @@ end it "returns an error if file has no rows" do - no_row_path = Rails.root.join("spec", "fixtures", "no_rows.csv") + no_row_path = Rails.root.join("spec", "fixtures", "no_rows.csv") no_row_importer = FileImporter.new(no_row_path, import_user.casa_org.id, "something", ["header"]) expect(no_row_importer.import[:message]).eql?(FileImporter::ERR_NO_ROWS) end diff --git a/spec/models/casa_case_spec.rb b/spec/models/casa_case_spec.rb index 6cd64fc9c6..7907fc2894 100644 --- a/spec/models/casa_case_spec.rb +++ b/spec/models/casa_case_spec.rb @@ -80,7 +80,7 @@ expect(casa_case.casa_case_contact_types.count).to eql 1 expect(casa_case.contact_types).to match_array([type1]) - casa_case.update_cleaning_contact_types({casa_case_contact_types_attributes: [{ contact_type_id: type2.id }]}) + casa_case.update_cleaning_contact_types({casa_case_contact_types_attributes: [{contact_type_id: type2.id}]}) expect(casa_case.casa_case_contact_types.count).to eql 1 expect(casa_case.contact_types.reload).to match_array([type2]) diff --git a/spec/models/case_contact_spec.rb b/spec/models/case_contact_spec.rb index 0ad3cf7cf5..082b6e5e5f 100644 --- a/spec/models/case_contact_spec.rb +++ b/spec/models/case_contact_spec.rb @@ -88,7 +88,7 @@ expect(case_contact.case_contact_contact_type.count).to eql 1 expect(case_contact.db_contact_types).to match_array([type1]) - case_contact.update_cleaning_contact_types({case_contact_contact_type_attributes: [{ contact_type_id: type2.id }]}) + case_contact.update_cleaning_contact_types({case_contact_contact_type_attributes: [{contact_type_id: type2.id}]}) expect(case_contact.case_contact_contact_type.count).to eql 1 expect(case_contact.db_contact_types.reload).to match_array([type2]) diff --git a/spec/policies/case_contact_policy/case_contact_policy_spec.rb b/spec/policies/case_contact_policy/case_contact_policy_spec.rb index 401943b1c0..bc3a9e947c 100644 --- a/spec/policies/case_contact_policy/case_contact_policy_spec.rb +++ b/spec/policies/case_contact_policy/case_contact_policy_spec.rb @@ -45,7 +45,7 @@ it "does not allow if is not supervisor of the creator" do expect(subject).to_not permit(create(:supervisor), - create(:case_contact, creator: create(:volunteer, supervisor: create(:supervisor)))) + create(:case_contact, creator: create(:volunteer, supervisor: create(:supervisor)))) end end @@ -100,7 +100,7 @@ it "does not allow if is not supervisor of the creator" do expect(subject).to_not permit(create(:supervisor), - create(:case_contact, creator: create(:volunteer, supervisor: create(:supervisor)))) + create(:case_contact, creator: create(:volunteer, supervisor: create(:supervisor)))) end end end diff --git a/spec/requests/casa_admins_spec.rb b/spec/requests/casa_admins_spec.rb index 223d765c02..9a11804d73 100644 --- a/spec/requests/casa_admins_spec.rb +++ b/spec/requests/casa_admins_spec.rb @@ -43,7 +43,7 @@ put casa_admin_path(casa_admin), params: { casa_admin: { email: expected_email, - display_name: expected_display_name, + display_name: expected_display_name } } @@ -63,7 +63,7 @@ put casa_admin_path(create(:casa_admin)), params: { casa_admin: { email: "admin@casa.com", - display_name: "The admin", + display_name: "The admin" } } @@ -77,7 +77,7 @@ put casa_admin_path(create(:casa_admin)), params: { casa_admin: { email: "admin@casa.com", - display_name: "The admin", + display_name: "The admin" } } diff --git a/spec/requests/casa_cases_spec.rb b/spec/requests/casa_cases_spec.rb index 355252787a..e84b602241 100644 --- a/spec/requests/casa_cases_spec.rb +++ b/spec/requests/casa_cases_spec.rb @@ -141,10 +141,10 @@ describe "PATCH /update" do context "with valid parameters" do - let(:new_attributes) { { case_number: "12345", court_report_submitted: true } } + let(:new_attributes) { {case_number: "12345", court_report_submitted: true} } it "updates fields (except case_number)" do - patch casa_case_url(casa_case), params: { casa_case: new_attributes } + patch casa_case_url(casa_case), params: {casa_case: new_attributes} casa_case.reload expect(casa_case.case_number).to eq "111" expect(casa_case.court_report_submitted).to be true @@ -192,10 +192,10 @@ describe "PATCH /update" do context "with valid parameters" do - let(:new_attributes) { { case_number: "12345", court_report_submitted: true } } + let(:new_attributes) { {case_number: "12345", court_report_submitted: true} } it "updates fields (except case_number)" do - patch casa_case_url(casa_case), params: { casa_case: new_attributes } + patch casa_case_url(casa_case), params: {casa_case: new_attributes} casa_case.reload expect(casa_case.case_number).to eq "111" expect(casa_case.court_report_submitted).to be true diff --git a/spec/requests/case_contacts_spec.rb b/spec/requests/case_contacts_spec.rb index 19fec1f2ae..2e05465625 100644 --- a/spec/requests/case_contacts_spec.rb +++ b/spec/requests/case_contacts_spec.rb @@ -71,7 +71,7 @@ patch case_contact_url(case_contact), params: { case_contact: { - case_contact_contact_type_attributes: [{ contact_type_id: contact_type.id }], + case_contact_contact_type_attributes: [{contact_type_id: contact_type.id}], duration_minutes: 60 } } diff --git a/spec/requests/contact_type_groups_spec.rb b/spec/requests/contact_type_groups_spec.rb index ce34c5e7c2..7ce0760df9 100644 --- a/spec/requests/contact_type_groups_spec.rb +++ b/spec/requests/contact_type_groups_spec.rb @@ -33,7 +33,7 @@ end describe "POST /contact_type_groups" do - let(:params) { { contact_type_group: { name: "New Group", active: true } } } + let(:params) { {contact_type_group: {name: "New Group", active: true}} } context "logged in as admin user" do it "can successfully create a contact type group" do @@ -106,7 +106,7 @@ end describe "PUT /contact_type_groups/:id" do - let(:params) { { contact_type_group: { name: "New Group Name", active: false } } } + let(:params) { {contact_type_group: {name: "New Group Name", active: false}} } context "logged in as admin user" do it "can successfully update a contact type group" do casa_org = create(:casa_org) diff --git a/spec/requests/contact_type_spec.rb b/spec/requests/contact_type_spec.rb index ea8b516d6f..e131d8f10f 100644 --- a/spec/requests/contact_type_spec.rb +++ b/spec/requests/contact_type_spec.rb @@ -34,7 +34,7 @@ end describe "POST /contact_types" do - let(:params) { { contact_type: { name: "New Contact", contact_type_group_id: group.id, active: true } } } + let(:params) { {contact_type: {name: "New Contact", contact_type_group_id: group.id, active: true}} } context "logged in as admin user" do it "can successfully create a contact type" do casa_org = create(:casa_org) @@ -108,7 +108,7 @@ describe "PUT /contact_types/:id" do let(:casa_org) { create(:casa_org) } let(:new_group) { create(:contact_type_group, casa_org: casa_org) } - let(:params) { { contact_type: { name: "New Name", contact_type_group_id: new_group.id, active: false } } } + let(:params) { {contact_type: {name: "New Name", contact_type_group_id: new_group.id, active: false}} } context "logged in as admin user" do it "can successfully update a contact type" do sign_in create(:casa_admin, casa_org: casa_org) diff --git a/spec/requests/imports_request_spec.rb b/spec/requests/imports_request_spec.rb index 451340d549..46d1308e6a 100644 --- a/spec/requests/imports_request_spec.rb +++ b/spec/requests/imports_request_spec.rb @@ -30,7 +30,7 @@ import_type: "volunteer", file: fixture_file_upload(supervisor_file) } - + expect(request.session[:import_error]).to include("Expected", VolunteerImporter::IMPORT_HEADER.to_s) expect(response).to redirect_to(imports_url(import_type: "volunteer")) end @@ -42,7 +42,7 @@ import_type: "supervisor", file: fixture_file_upload(volunteer_file) } - + expect(request.session[:import_error]).to include("Expected", SupervisorImporter::IMPORT_HEADER.to_s) expect(response).to redirect_to(imports_url(import_type: "supervisor")) end @@ -54,7 +54,7 @@ import_type: "casa_case", file: fixture_file_upload(supervisor_file) } - + expect(request.session[:import_error]).to include("Expected", CaseImporter::IMPORT_HEADER.to_s) expect(response).to redirect_to(imports_url(import_type: "casa_case")) end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 80eee3eca4..b4c07e8538 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,18 +1,18 @@ -require 'capybara/rails' -require 'selenium/webdriver' +require "capybara/rails" +require "selenium/webdriver" Capybara.register_driver :selenium_chrome_in_container do |app| Capybara::Selenium::Driver.new app, browser: :remote, - url: 'http://selenium_chrome:4444/wd/hub', + url: "http://selenium_chrome:4444/wd/hub", desired_capabilities: :chrome end Capybara.register_driver :selenium_chrome_headless_in_container do |app| Capybara::Selenium::Driver.new app, browser: :remote, - url: 'http://selenium_chrome:4444/wd/hub', + url: "http://selenium_chrome:4444/wd/hub", desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome( - chromeOptions: { args: %w[headless disable-gpu --window-size=1280,900] } + chromeOptions: {args: %w[headless disable-gpu --window-size=1280,900]} ) end diff --git a/spec/support/pundit_helper.rb b/spec/support/pundit_helper.rb index 921e126f49..b887735ee6 100644 --- a/spec/support/pundit_helper.rb +++ b/spec/support/pundit_helper.rb @@ -6,4 +6,4 @@ def enable_pundit(view, user) end end end -end \ No newline at end of file +end diff --git a/spec/system/creating_casa_admins_spec.rb b/spec/system/creating_casa_admins_spec.rb index 4c3a0876ed..5a9c0ab5cd 100644 --- a/spec/system/creating_casa_admins_spec.rb +++ b/spec/system/creating_casa_admins_spec.rb @@ -27,5 +27,4 @@ expect(page).to have_content "Email is invalid" end - end diff --git a/spec/system/supervisor_edits_case_spec.rb b/spec/system/supervisor_edits_case_spec.rb index 9f4d79f134..6fd47ee738 100644 --- a/spec/system/supervisor_edits_case_spec.rb +++ b/spec/system/supervisor_edits_case_spec.rb @@ -5,7 +5,7 @@ let(:supervisor) { create(:supervisor, casa_org: casa_org) } let(:casa_case) { create(:casa_case, casa_org: casa_org) } let!(:contact_type_group) { create(:contact_type_group, casa_org: casa_org) } - let!(:contact_type_1) { create(:contact_type, name: "Youth", contact_type_group: contact_type_group ) } + let!(:contact_type_1) { create(:contact_type, name: "Youth", contact_type_group: contact_type_group) } let!(:contact_type_2) { create(:contact_type, name: "Supervisor", contact_type_group: contact_type_group) } before do diff --git a/spec/system/volunteer_adds_a_case_contact_spec.rb b/spec/system/volunteer_adds_a_case_contact_spec.rb index 9380acec37..f36276a255 100644 --- a/spec/system/volunteer_adds_a_case_contact_spec.rb +++ b/spec/system/volunteer_adds_a_case_contact_spec.rb @@ -214,7 +214,7 @@ end end -private + private def create_contact_types(org) create(:contact_type_group, casa_org: org).tap do |group| diff --git a/spec/views/case_contacts/index.html.erb_spec.rb b/spec/views/case_contacts/index.html.erb_spec.rb index 63cdaf7568..8d43f21b8a 100644 --- a/spec/views/case_contacts/index.html.erb_spec.rb +++ b/spec/views/case_contacts/index.html.erb_spec.rb @@ -22,4 +22,4 @@ expect(rendered).to have_selector("th", text: "Contact Made") expect(rendered).to have_selector("th", text: "Miles Driven") end -end \ No newline at end of file +end diff --git a/spec/views/dashboard/show.html.erb_spec.rb b/spec/views/dashboard/show.html.erb_spec.rb index b527057b69..34e6120957 100644 --- a/spec/views/dashboard/show.html.erb_spec.rb +++ b/spec/views/dashboard/show.html.erb_spec.rb @@ -2,6 +2,5 @@ describe "dashboard/show", type: :view do context "logged in as an admin" do - end end