Skip to content

Fix pricing, optimize dashboard, and add duplicate orders - #2

Open
rayhq wants to merge 1 commit into
MulearnMCE:masterfrom
rayhq:fix/orbitstack-challenge
Open

Fix pricing, optimize dashboard, and add duplicate orders#2
rayhq wants to merge 1 commit into
MulearnMCE:masterfrom
rayhq:fix/orbitstack-challenge

Conversation

@rayhq

@rayhq rayhq commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Completed all three OrbitStack coding challenge tasks.

Task 1 — Pricing Logic

  • Fixed double-counting of free-shipping discounts.
  • Preserved existing discount behavior.
  • Prevented incorrect shipping discount calculations.

Task 2 — Dashboard Performance

  • Removed the N+1 order/order-item query pattern.
  • Optimized Prisma order fetching using relations.
  • Limited dashboard order history to the required 30-day period.

Task 3 — Duplicate Order

  • Added POST /api/orders/[id]/duplicate.
  • Added authentication and ownership validation.
  • Skips inactive/out-of-stock products.
  • Handles available stock quantities.
  • Added Duplicate Order UI to dashboard orders.
  • Integrated with the existing Zustand cart store.

Validation

  • npm run test — 11 tests passed
  • npx tsc --noEmit — passed
  • npm run build — passed

Documentation

  • Updated AI_LOG.md with AI usage and development workflow.

@rayhq rayhq changed the title fix: complete OrbitStack coding challenge Fix pricing, optimize dashboard, and add duplicate orders Aug 11, 2026
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.

1 participant