-
-
Notifications
You must be signed in to change notification settings - Fork 473
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
Custom court report templates per org #1942
Merged
compwron
merged 18 commits into
rubyforgood:main
from
FireLemons:custom_court_report_templates_per_org
Apr 15, 2021
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c42f6f6
removed vestigial line
FireLemons 645fbf0
court report template can be uploaded for an org
FireLemons 7ed87cf
created method for accessing court report template
FireLemons fd1687c
removed unused method
FireLemons a72f33b
uploaded template is used for generation
FireLemons 6fab6f9
renamed prince george template
FireLemons 8223a9a
linter
FireLemons 70fcef3
fixed rspec tests
FireLemons db3c1cc
default court report template uses org address
FireLemons e69167a
removed unused hidden text
FireLemons 9fed89c
updated test for new optional key
FireLemons 87a5866
created montgomery template
FireLemons abab463
created script to set custom org court documents
FireLemons 733b6ff
templates support court mandates
FireLemons fe2f00b
linter
FireLemons 5ef5a76
fixed syntax
FireLemons 7a1a779
linting
FireLemons 13355dd
lint
FireLemons File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+1.76 MB
app/documents/templates/report_template.docx → ...plates/prince_george_report_template.docx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace :after_party do | ||
desc "Deployment task: set_custom_court_docs_for_orgs" | ||
task task_name: :environment do | ||
CasaOrg.where(name: "Prince George CASA").map do |casa_org| | ||
casa_org.court_report_template.attach(io: File.new(Rails.root.join("app", "documents", "templates", "prince_george_report_template.docx")), filename: "prince_george_report_template.docx") | ||
end | ||
|
||
CasaOrg.where(name: "Voices for Children Montgomery").map do |casa_org| | ||
casa_org.court_report_template.attach(io: File.new(Rails.root.join("app", "documents", "templates", "montgomery_report_template.docx")), filename: "montgomery_report_template.docx") | ||
end | ||
|
||
AfterParty::TaskRecord | ||
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
describe "when receiving valid case, volunteer, and path_to_template" do | ||
let(:casa_case_without_contacts) { volunteer.casa_cases.second } | ||
let(:casa_case_with_contacts) { volunteer.casa_cases.first } | ||
let(:path_to_template) { "app/documents/templates/report_template.docx" } | ||
let(:path_to_template) { "app/documents/templates/default_report_template.docx" } | ||
let(:path_to_report) { "tmp/test_report.docx" } | ||
let(:report) do | ||
CaseCourtReport.new( | ||
|
@@ -50,15 +50,6 @@ | |
end | ||
end | ||
|
||
describe "has valid @path_to_template" do | ||
it "is existing" do | ||
path = report.template.instance_variable_get(:@path) | ||
|
||
expect(File.exist?(path_to_template)).to eq true | ||
expect(File.exist?(path)).to eq true | ||
end | ||
end | ||
|
||
describe "has valid @context" do | ||
subject { report.context } | ||
|
||
|
@@ -67,7 +58,7 @@ | |
|
||
it "has the following keys [:created_date, :casa_case, :case_contacts, :volunteer]" do | ||
expected = %i[created_date casa_case case_contacts volunteer] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to refactor this test to be more clear someday, doesn't have to be in this PR tho |
||
expect(subject.keys).to eq expected | ||
expect(subject.keys).to include(*expected) | ||
end | ||
|
||
it "must have Case Contacts as type Array" do | ||
|
@@ -82,15 +73,6 @@ | |
expect(report_as_data).not_to be_nil | ||
expect(report_as_data).to be_instance_of String | ||
end | ||
|
||
it "successfully generates to file" do | ||
report.generate! | ||
|
||
expect(File.exist?(path_to_report)).to eq true | ||
|
||
# clean up after testing | ||
File.delete(path_to_report) if File.exist?(path_to_report) | ||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to make this string a variable
default_report_template.docx