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

UserLoans#update | PATCH api/v1/users/:id/loans/:id #51

Merged
merged 4 commits into from
Oct 22, 2023

Conversation

kem247
Copy link
Contributor

@kem247 kem247 commented Oct 22, 2023

Changes:

  • to controller, route, and testing files plus rubocop

This is related to #33

This closes #33

[x] I linted my work. (RuboCop)

[] I've updated documentation & README. (if necessary)


(For Fun!) Please include a link to a meme/gif of your feelings about this branch!

Link:

def update
user = User.find(params[:id])
loans = Loan.where(owner_id: user.id).or(Loan.where(borrower_id: user.id))
loan_id = loans.find(params[:loan_id])
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable name should change from loan_id to loan since it is a loan object and not just an id number


def update
user = User.find(params[:id])
loans = Loan.where(owner_id: user.id).or(Loan.where(borrower_id: user.id))
Copy link
Contributor

Choose a reason for hiding this comment

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

this logic is not needed since we have the loan_id being passed through params:
loan = Loan.find(params[:id])


if params[:action_type] == 'deny' || params[:action_type] == 'withdraw'
if loan_id.update(status: 2)
dashboard_info = user.find_dashboard_info
Copy link
Contributor

Choose a reason for hiding this comment

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

Good logic here to try and update dashboard but not necessary, can be deleted

Copy link
Contributor

@MelTravelz MelTravelz left a comment

Choose a reason for hiding this comment

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

Great work! Please see my comment

@MelTravelz MelTravelz changed the title UserLoans#update | PATCH "api/v1/users/:id/loans/:id" UserLoans#update | PATCH api/v1/users/:id/loans/:id Oct 22, 2023
@MelTravelz MelTravelz merged commit b1f1330 into main Oct 22, 2023
1 check passed
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.

UserLoans#update | PATCH "api/v1/users/:id/loans/:id"
2 participants