Sales reports (E-commerce Store (full stack))
GET /admin/reports → 200 {"average","orders","refunded","revenue","top"}: orders and revenue count orders that are not cancelled, average = revenue // orders (0 with none), top is the 3 best-selling products by quantity (ties by id) as {"product","qty"}, refunded is the sum of all refunds.
Input: As before.
Output: As before.
Difficulty: Hard. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Loop over orders once and accumulate everything.