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

[#1739] Add court details to past court dates #2080

Merged

Conversation

rhian-cs
Copy link
Contributor

@rhian-cs rhian-cs commented May 25, 2021

What github issue is this PR for, if any?

Resolves #1739

What changed, and why?

As requested in #1739, the past court dates now have a page of their own with additional information about the CASA case at the time, such as: judge, hearing type and court mandates.

The link to that page is available at the edit page of a given CASA case.

Acceptance Criteria

  • Dates are clickable underneath "Past Court Dates" on the Edit CASA Case page.
  • Clicking on a date takes you to a page where you can see details associated with that past court date, including:
    • Hearing type
    • Judge
    • Court mandates and implementation status

How will this affect user permissions?

The permissions to access the past court date page mirror the permissions to edit the associated case.

  • Volunteer permissions: Can only see the page if they are associated with the case
  • Supervisor permissions: Can only see the page if they are in the same organization as the case
  • Admin permissions: Can always see the page

How is this tested? (please write tests!) 💖💪

Automated tests

  • Added model and request specs for the past court dates
  • Added view specs for the past court date show page
  • Modified the system specs for the CASA case edit page to check if the court dates links are actually visible

Manual testing

I also had to test if the heroku scheduler task was working, so I modified a CASA case to:

  • Have court details
  • Have a next court date in the past (so the scheduler task picks it up)

And then I ran the scheduler task.

Screenshots please :)

The CASA case edit page now have links to the past court dates

01-desktop-edit

Past court dates page (desktop)

02-desktop-show

Past court dates page (mobile top)

03-mobile-show

Past court dates page (mobile bottom)

04-mobile-show

To be honest I'm not a big fan of how the table looks in mobile, but I thought I shouldn't modify the global table style just for this alteration.

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels May 25, 2021
@compwron
Copy link
Collaborator

Exciting!
@Diego-Thomaz what criteria are you using to review this PR?

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is looking great! Please don't merge until I get a chance to look it over in more depth tonight :)

@compwron
Copy link
Collaborator

Please fix the failing test :)

Failed examples:

rspec ./spec/requests/past_court_dates_spec.rb:16 # /casa_cases/:casa_case_id/past_court_dates/:id GET /show when the request is authenticated 

https://github.com/rubyforgood/casa/pull/2080/checks?check_run_id=2669068108

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! :)

@Diego-Thomaz
Copy link

Exciting!
@Diego-Thomaz what criteria are you using to review this PR?

Hi @compwron , I'm mentoring @rhian-cs in his open sources. He usually give me context about the issues he's working on, and I review his code to help him.

@compwron
Copy link
Collaborator

Very cool :)

@rhian-cs rhian-cs force-pushed the 1739-add-court-details-to-past-court-dates branch from 5376f33 to c498889 Compare May 26, 2021 20:28
@github-actions github-actions bot added the erb label May 26, 2021
@rhian-cs
Copy link
Contributor Author

Please fix the failing test :)

My bad, it was working locally so I thought it was just a flake. Disabling bullet for the spec fixed it though.

@compwron
Copy link
Collaborator

As per our stakeholder meeting today, we do NOT want to wipe court mandates when a court date passes, because the mandates often stay the same.

Also on a technical level, it does not yet seem useful to save a snapshot of old court mandates when a court report rolls over to the past. Maybe someday.

let(:volunteer) { create(:volunteer, casa_org: organization) }
let(:supervisor) { create(:supervisor, casa_org: organization) }

permissions :show? do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are great tests, yay testing permissions :)

@@ -0,0 +1,25 @@
require "rails_helper"

RSpec.describe "/casa_cases/:casa_case_id/past_court_dates/:id", :disable_bullet, type: :request do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to start un-breaking bullet... we have way too many n+1s
https://github.com/flyerhzm/bullet

end

let!(:formatted_date_with_details) { I18n.l(past_court_date_with_details.date, format: :full, default: nil) }
let!(:formatted_date_without_details) { I18n.l(past_court_date_without_details.date, format: :full, default: nil) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather spell this out than reference the yaml- tests don't need to be as DRY as prod code. tests Should not test prod code by running other prod code

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful :)

@compwron compwron merged commit 40d4353 into rubyforgood:main May 27, 2021
@rhian-cs rhian-cs deleted the 1739-add-court-details-to-past-court-dates branch May 27, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erb ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Past court dates reveal past court details
3 participants