Free code review exercise
Would you approve this change?
Complete this exercise free. Create an account afterward if you want to save your result and keep practicing.
Backend EngineerPythonMid-level
The change
This change lets a signed-in customer update the shipping address on an existing order. It receives a transaction-mode database connection and should save the new address before reporting success.
Review this change as if it were a pull request. Identify correctness or security problems, explain what could break, and suggest practical fixes.
Added · orders.py
+def update_shipping_address(conn, actor_user_id: int, order_id: int, new_address: str) -> bool:+ with conn.cursor() as cursor:+ cursor.execute("SELECT customer_id FROM orders WHERE id = %s", (order_id,))+ order = cursor.fetchone()+ if order is None:+ return False+ + cursor.execute(+ f"UPDATE orders SET shipping_address = '{new_address}' WHERE id = {order_id}"+ )+ return TrueYour review
Explain each issue you find, why it matters, and how you would fix it. Write in your own words.
0/6000 characters
Preparing your guest session…