Code Room
Code reviewHard
Question
Review this Python (SQLAlchemy) lookup for a user’s recent active orders.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
def recent_active(session, user_id): orders = session.query(Order).all() # load the whole table result = [] for o in orders: if o.user_id == user_id and o.status == "active": if o.created_at >= last_30_days(): result.append(o) return resultRun or narrate your approach, then ask the coach.