Skip to content

Fix: Removed broken API request from 7.bank solution (Fixes #1384) #1437

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

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

Conversation

yashshinde8585
Copy link

@yashshinde8585 yashshinde8585 commented Jul 6, 2025

Description

This pull request resolves issue #1384 by removing a broken API request in the 7.bank/solution directory. The API request was not functional and caused the login template to fail. Since the API was unnecessary for the learning objective of this lesson, it has been removed to ensure the solution runs smoothly.

Fixes #1384

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@yashshinde8585
Copy link
Author

@microsoft-github-policy-service agree

Copy link

@OrangeDoro OrangeDoro left a comment

Choose a reason for hiding this comment

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

Hi! I'm a grad student working on a research project about using large language models to automate code review. Based on your commit 85cc30f and the changes in 7-bank-project/solution/app.js, my tool generated this comment:

  1. In the createAccount function, wrap the parsing of accountJson in a try-catch block to handle potential errors gracefully.
  2. In the createTransaction function, wrap the parsing of transactionJson in a try-catch block to handle invalid JSON input.
  3. Before modifying the balance by adding tx.amount, check that tx.amount is a valid number to avoid incorrect balance calculations.
  4. Add a check in the createTransaction function to ensure that tx.amount is greater than or equal to zero if only positive transactions are allowed.
  5. Standardize error handling across functions to ensure that errors, such as when an account is not found, are handled appropriately.
  6. Ensure that the calling code can handle the case where findAccount returns null to avoid unexpected behavior.
  7. Implement appropriate error handling for cases where localStorage might be full or unavailable, such as in private browsing mode.
  8. In both createAccount and createTransaction, check that transactionJson and accountJson parameters are not null or undefined before attempting to parse them.
  9. In the createAccount function, add validation to ensure that the currency field is a valid currency code.
  10. In the createTransaction function, validate the date field to ensure it is in the correct format before assigning it.
  11. Consider creating a utility function that handles fetching accounts from localStorage to avoid redundancy and improve performance.
  12. Consider refactoring the createAccount and createTransaction functions to handle real promises or async/await patterns more effectively.
  13. Consider implementing logging to track the operations performed on accounts for debugging purposes.
  14. The comment // API interactions (replaced with localStorage logic) could specify that the API interactions have been replaced with local storage operations for better understanding.
  15. Consider using a more descriptive name like localStorageAccountsKey for accountsKey to enhance clarity about its context.
  16. Ensure there is a test that verifies getAccounts() correctly retrieves accounts from localStorage, including scenarios where localStorage is empty and where it contains multiple accounts.

As part of my research, I'm trying to understand how useful these comments are in real-world development. If you have a moment, I'd be super grateful if you could quickly reply to these two yes/no questions:

  1. Does this comment provide suggestions from a dimension you hadn’t considered?

  2. Do you find this comment helpful?

Thanks a lot for your time and feedback! And sorry again if this message is a bother.

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.

api bug
2 participants