Skip to content

Code Review Comments (Hunter Lathery) #6

@hlathery

Description

@hlathery
  1. In chore_assignment, it seems a little redundant to have a whole class for just the status of a chore when you only use it once and it's just a string input.

  2. In endpoints bill and chore_assignment, you import other endpoints but never use them, so you can probably clear that from the list of imports if not planning to use anymore

  3. Creating a chore with priority < 1 or > 5 currently throws a 500 error. I see your schema currently requires that it be priority >= 1 and <= 5 But maybe inside your endpoint file you can add a more user friendly check to let the user know, and allow retry ability without throwing a 500 error. Similar to how you did with HTTP exception in assign_chore

  4. I’m assuming WIP but the admin/reset is currently not implemented yet

  5. Add a check in create roommate to not allow for duplicate roommate if they are already created, your initial population of the 3 example roommates accomplishes this, but just add for others

  6. Thought most endpoint names are self explanatory, it might be nice to add a docstring to each of your endpoints

  7. A big improvement to readability I think would be in your assign chore method, instead of individually querying if each check exists, and then doing another query. You could instead do the insert plus the desired WHERE, and then just do a if result.rowcount == 0: raise httpexception and handle accordingly.

  8. In update chore status, currently you can enter any chore id or roommate id you wish, and not include a status and it will say the chore status is successfully updated. Consider also setting the status as an enum like you do in your bill endpoint (unpaid = 'unpaid' etc…)

  9. For update bill status, if the user provides an incorrect bill_id OR roomate_id it will send back the same message saying No bill found with specific ID, even if you give it a correct bill_id but incorrect roommate id, consider the AND case as well.

  10. Line 57 inside create_bill, instead of assigning a new variable to len(roommates), you could just do if roommates.rowcount == 0: raise exception.

  11. Line 60 create_bill, since we’re dealing with dollars and cents, probably round to 2 decimal so you don't have this: “amount”: 9.3333 , instead 9.33 ($9 and 33 cents)

  12. Add a check for creating bill to not allow negative cost of bill

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions