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

[#1741] Generate past court reports from past court date #2095

Conversation

rhian-cs
Copy link
Contributor

@rhian-cs rhian-cs commented Jun 2, 2021

What github issue is this PR for, if any?

Resolves #1741

What changed, and why?

Admins, supervisors and case volunteers are now able to download a .docx report of a given past court date.

How will this affect user permissions?

The permissions to download the .docx reports are the same as the ones to see the past court date itself (since it is the same action in the controller).

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

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

Automated specs:

  • Updated past court date request specs to see if it downloads the .docx
  • Updated past court date view specs to check if the Download button is visible
  • Created past court date model specs

Manual testing:

  • Create some past court dates, with (and without) court details
  • Go to the page, download the report and check if everything is displayed properly

Screenshots please :)

A new button is now present at the past court date page

1

Desktop view:

2

Mobile view:

3

Generated document:

4

Feelings gif (optional)

What it felt like to be forced to use Microsoft Word to generate the template:

errors

Just kidding ;)
No errors occurred but I had to use someone else's computer to use MS Word

@github-actions github-actions bot added erb ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Jun 2, 2021
class PastCourtDate < ApplicationRecord
belongs_to :casa_case

has_many :case_court_mandates
belongs_to :hearing_type, optional: true
belongs_to :judge, optional: true

DOCX_TEMPLATE_PATH = "app/documents/templates/default_past_court_date_template.docx"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style note: prefer to use Rails.root.join

describe "methods" do
let(:past_court_date) { build_stubbed(:past_court_date) }

pending "#associated_reports"
Copy link
Collaborator

Choose a reason for hiding this comment

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

please implement the pending tests also

@compwron compwron merged commit 25ef045 into rubyforgood:main Jun 3, 2021
@compwron
Copy link
Collaborator

compwron commented Jun 3, 2021

👏🏼 🙌🏼 💪 ✨ 📈

@rhian-cs rhian-cs deleted the 1741-generate-past-court-report-from-past-court-date branch June 7, 2021 17:36
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.

generate past court reports associated with past court dates
2 participants