SA-01: Code Challenge - Coffee Shop (Object Relationships) [COMPULSORY]

Close

**Project Overview


For this assignment, we'll be working with a Coffee shop-style domain. We have three models: Coffee, Customer, and Order. For our purposes, a Coffee has many Orders, a Customer has many Orders, and an Order belongs to a Customer and to a Coffee. Coffee - Customer is a many-to-many relationship. Note: You should draw your domain on paper or on a whiteboard before you start coding. Remember to identify a single source of truth for your data.

Project Setup & Folder Structure

**

  1. Create a new repository
    • Name it (for example) coffee-shop-challenge.
    • Initialize with a README.md.
  2. Clone locally
  3. Initialize your Python environment
  4. Define your folder & file layout
  5. Initial commit

☕ Coffee-Shop Challenge: Requirements

1. Models & Initializers

Customer

Coffee

Order


2. Object Relationships


3. Aggregates & Associations


4. Bonus (Optional)

Happy Coding

Keep in mind that 165 students have already been assessed using this rubric. Changing it will affect their evaluations.

SA: Mock Code Challenge - Coffee Shop (Object Relationships) Rubric

Criteria Ratings Pts
Customer initializer & name property Edit criterion description 2 pts Points Initializer and name getter/setter both enforce type and length correctly (1–15 chars) and setter works 1 pts Partial Partial enforcement: either type or length checks are missing, or the setter/getter is only partly functional 0 pts No Marks No implementation or completely incorrect pts 2 pts --
Coffee initializer & name property Edit criterion description 2 pts Full Marks Initializer and name getter enforce type and ≥3-char length correctly, and name is immutable after init 1 pts Partial Partial enforcement: type or length check missing, or immutability not enforced 0 pts No Marks No implementation or completely incorrect pts 2 pts --
Order initializer & price property Edit criterion description 2 pts Full Marks Initializer takes Customer, Coffee, float price (1.0–10.0) and price is immutable 1 pts Partial Partial enforcement: wrong type/range checks or immutability not enforced 0 pts No Marks No implementation or completely incorrect pts 2 pts --
Relationship methods & properties Edit criterion description 4 pts Full Marks All `Order.customer`, `Order.coffee`, `Coffee.orders()`, `Coffee.customers()`, `Customer.orders()`, `Customer.coffees()` work correctly and return proper unique lists 3 pts Partial One method has minor bug (e.g. duplicates or wrong type), but the rest work 2 pts Partial Some methods work correctly, others missing or majorly flawed 1 pts Partial Only one or two relationship methods implemented correctly 0 pts Partial No relationship methods are implemented pts 4 pts --
Aggregate/association methods Edit criterion description 3 pts Full Marks Customer.create_order()`, `Coffee.num_orders()`, and `Coffee.average_price()` are all correct 2 pts Partial One of the three methods is missing or has a bug 1 pts Partial Aggregate methods exist but are mostly incorrect 0 pts No Marks No aggregate/association methods implemented pts 3 pts --
Bonus: Customer.most_aficionado(coffee) Edit criterion description 2 pts Full Marks Correctly returns the customer who spent the most or `None` if no orders 1 pts Partial Method exists but fails on edge cases (e.g. ties or empty orders) 0 pts No Marks Not implemented or completely incorrect pts 2 pts --