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

4175 add request type flag #4271

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

nathangthomas
Copy link

Resolves #4175

Description

Adds a request type flag to index and show pages as well as to the downloadable document so that banks can better see which type of request is being made.

Type of change

  • New feature (non-breaking change which adds functionality)

This can be manually tested by logging in as a bank user.

  Organization Admin
     Email: org_admin1@example.com
  Password: password!

  User
  Email: user_1@example.com
  Password: password!

Screenshots

Screenshot 2024-04-02 at 8 41 09 AM Screenshot 2024-04-02 at 8 41 21 AM

Requests-2024-04-02.csv

app/controllers/partners/family_requests_controller.rb Outdated Show resolved Hide resolved
@@ -19,6 +20,7 @@ def call
return self unless valid?

request_create_svc = Partners::RequestCreateService.new(
request_type: @request_type.to_i,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This service should already know the request type just by whether for_families is true or false.

Copy link
Author

Choose a reason for hiding this comment

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

I feel that defining request_type in this way is more transparent. Would you prefer to add logic in the controller to determine request_type rather than using the instance var?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer putting the business logic as far back as possible. The controller is calling a service, which already has to know what kind of request it's creating. We can rely on the service to set the request type.

app/views/requests/_request_type.html.erb Outdated Show resolved Hide resolved
config/database.yml Outdated Show resolved Hide resolved
spec/models/request_spec.rb Outdated Show resolved Hide resolved
@cielf
Copy link
Collaborator

cielf commented May 7, 2024

Understood. The rest still needs @dorner 's technical ok -- it's not crucial for it to get in this week.

Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Sorry I didn't think of this during the last review, but I think it'd make a big difference in understandability.

app/controllers/partners/family_requests_controller.rb Outdated Show resolved Hide resolved
@nathangthomas nathangthomas requested a review from dorner May 15, 2024 19:00
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Almost there!

@@ -13,7 +13,7 @@
<%= request_row.comments %>
</td>
<td>
<%= request_row&.request_type&.titleize %>
<%= request_row&.request_type&.first&.capitalize %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we extract this into a method on request? It's a bit obscure. If you call it something like request_type_label with a comment it'd be more obvious.

db/schema.rb Outdated
@@ -849,7 +849,8 @@
end

create_table "versions", force: :cascade do |t|
t.string "item_type", null: false
t.string "item_type"
t.string "{:null=>false}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is supposed to be here?

Copy link
Author

Choose a reason for hiding this comment

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

This was automatically changed when I ran the migrations last. I reverted it.

@nathangthomas nathangthomas requested a review from dorner May 16, 2024 14:16
@nathangthomas nathangthomas requested a review from cielf May 16, 2024 14:38
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Tried it on my local. Signed in as verified@example.com, entered a quantity request and got
Screenshot 2024-05-16 at 3 44 50 PM

@cielf
Copy link
Collaborator

cielf commented May 16, 2024

Same effect for individual and child request. (Not at all surprised by that)

@nathangthomas
Copy link
Author

Well that is embarrassing. I'll take a look at it this afternoon.

@nathangthomas nathangthomas requested a review from cielf May 17, 2024 20:55
@nathangthomas
Copy link
Author

Seems I either forgot to add or removed request_type from the initializers. I have replaced them and tested locally. Everything should work as expected now.

cielf
cielf previously requested changes May 18, 2024
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Alas, the quantity requests are showing up as "I" now. (Strange -- I think I confirmed them as working correctly before ...)

@nathangthomas nathangthomas requested a review from cielf May 21, 2024 17:27
@cielf
Copy link
Collaborator

cielf commented May 21, 2024

There's an issue with setup that's currently blocking me doing functional reviews -- just managing your expectations as to turnaround time.

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

LGTM now. @dorner?

@cielf cielf dismissed their stale review May 22, 2024 18:48

addessed,

@@ -8,7 +8,7 @@ class FamilyRequestCreateService

attr_reader :partner_user_id, :comments, :family_requests_attributes, :partner_request

def initialize(partner_user_id:, family_requests_attributes:, comments: nil, for_families: false)
def initialize(request_type:, partner_user_id:, family_requests_attributes:, comments: nil, for_families: false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait, why was this put back? We agreed that it wouldn't be needed because the service itself knows what type it is just by the current parameters being passed in.

@dorner
Copy link
Collaborator

dorner commented May 24, 2024

Had a question... also, lint is failing now.

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.

Add a flag that is the type of request.
3 participants