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

Simple Forms: Refactor PDF Stamper Part 1 #16268

Merged
merged 7 commits into from
Apr 15, 2024
Merged

Conversation

Thrillberg
Copy link
Contributor

@Thrillberg Thrillberg commented Apr 9, 2024

Summary

This PR takes part of the work from this draft PR: #16242 and separates it into its own standalone PR. This should be more easily reviewable. I can then come back and apply part 2 in a separate PR and close out the aforementioned draft PR.

This is some refactoring of our PDF Stamper class with the ultimate aim of making it more uniform in how it handles desired stamps.

Related issue(s)

https://app.zenhub.com/workspaces/vagov-product-team-forms-634853151f5c6000165942bc/issues/gh/department-of-veterans-affairs/va.gov-team-forms/1198

Testing done

Tests altered and passing.

Copy link

github-actions bot commented Apr 9, 2024

1 Warning
⚠️ This PR changes 300 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb (+11/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21_0845.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21_0966.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21_0972.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21_10210.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21_4142.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_21p_0847.rb (+4/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vba_26_4555.rb (+12/-0)

  • modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_1.rb (+4/-0)

  • modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb (+41/-141)

  • modules/simple_forms_api/spec/services/pdf_stamper_spec.rb (+21/-46)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/, *.bru
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger

@Thrillberg Thrillberg changed the title Refactor pdf stamper 1 Simple Forms: Refactor PDF Stamper Part 1 Apr 9, 2024
@Thrillberg Thrillberg marked this pull request as ready for review April 9, 2024 21:18
@Thrillberg Thrillberg requested review from a team as code owners April 9, 2024 21:18
@va-vfs-bot va-vfs-bot temporarily deployed to refactor-pdf-stamper-1/main/main April 9, 2024 22:27 Inactive
@stevenjcumming
Copy link
Contributor

@Thrillberg Could you ask a teammate for a review, then I'll review it

Comment on lines 35 to 37
def desired_stamps
[
{
coords: [50, 560],
text: data['statement_of_truth_signature'],
page: 1
}
]
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this one was formatted differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NAWP! Fixing now 😸

Comment on lines 152 to 159
config = [
{ type: :new_page },
{ type: :new_page },
{ type: :new_page },
{ type: :new_page }
]
config[page] = { type: :text, position: }
config
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be rewritten with .tap:

Suggested change
config = [
{ type: :new_page },
{ type: :new_page },
{ type: :new_page },
{ type: :new_page }
]
config[page] = { type: :text, position: }
config
[
{ type: :new_page },
{ type: :new_page },
{ type: :new_page },
{ type: :new_page }
].tap do |config|
config[page] = { type: :text, position: }
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes! I need to get more used to tap.

pennja
pennja previously approved these changes Apr 15, 2024
Copy link
Contributor

@pennja pennja left a comment

Choose a reason for hiding this comment

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

Looks good to me, just one question and one small suggestion. 👍

Copy link
Contributor

@pennja pennja left a comment

Choose a reason for hiding this comment

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

Looks good to me, great work again! 👍

@Thrillberg Thrillberg merged commit 4e7c4d2 into master Apr 15, 2024
20 checks passed
@Thrillberg Thrillberg deleted the refactor-pdf-stamper-1 branch April 15, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants