JetBrains-Research / JetBrains-Research/Python-Solution-Preference

[009] Furniture Delivery Pricing Calculator (MVP)

未关闭
#9 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
没有语言数据
星标
2
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

## Overview

Deterministic calculator for furniture delivery quotes. No payments, no accounts. Application starts empty; Admin configures all data.

Build this as a Python backend service with no UI; expose the functionality below through an HTTP API.

## Data Model

- **Settings:** Rural Rate per km, Assembly Rate per 15-min interval, Rubbish Flat Rate
- **Locations:** type (store/warehouse/supplier), name, address, city, suburb
- **Rate Cards:** serviceType (B2B/B2C), fromCity, toCity, toSuburb, ratePerM3
- **Furniture Catalog:** SKU, name, cubic metres, category

## Quote Calculation

### Inputs

- Delivery Type: B2C or B2B
- Origin: select from locations
- Destination: B2C = enter City (required) + Suburb (optional); B2B = select from locations
- Items: from catalog (quantity 1-10, optional m³ override) or custom (name, m³, quantity 1-10)
- Services: Assembly intervals (0-99), Rubbish quantity (0-99), Rural km (B2C only, ≥0)

Required: Delivery Type, Origin, Destination, at least one item. Calculation is rejected until all required inputs are present.

### Rate Matching

Filter rate cards by serviceType = Delivery Type AND fromCity = Origin's city.

- Destination city/suburb: B2C uses entered values; B2B uses selected location's city/suburb.
- **Exact Match:** toCity AND toSuburb both match destination (empty matches empty). Select lowest ratePerM3. Result labeled "Exact Match".
- **City Match (fallback):** toCity matches but toSuburb doesn't. Select highest ratePerM3. Result labeled "City Match" with "N suburbs available for this city." where N = count of unique non-empty toSuburb values for matching toCity.
- **Unavailable:** no toCity match. Result: "No rate card for selected route and delivery type."

### Pricing Formulas

- Volume Charged = MAX(1.00, Total Cubic Metres)
- Base Delivery = ratePerM3 × Volume Charged
- Assembly Cost = Assembly Rate × intervals
- Rubbish Cost = Rubbish Flat Rate × quantity
- Rural Cost = Rural Rate × km (B2C only; B2B = 0)
- Total = Base Delivery + Assembly + Rubbish + Rural

### Output

- Currency and volumes to two decimals
- When volume < 1.00, indicate "X.XX m³ (charged as 1.00 m³)"
- Rural km is not accepted for B2B

## Quotes Management

- A quote can be saved after any calculation result (including Unavailable)
- Save captures immutable snapshot (inputs, rates, costs)
- Saved quotes preserve original rates unchanged by later Admin edits
- Quotes list shows: timestamp, delivery type, origin city, destination "City (Suburb)", match tier, total (or "Unavailable")
- Quote detail shows: items, services, matched ratePerM3, volume charged, cost breakdown
- Quotes can be deleted

## Admin

- Manage Settings, Locations, Rate Cards, and Furniture Catalog (add/edit/delete)
- Reset Data: clears all locations, rate cards, catalog, quotes; resets settings to zero

## Empty Data Behavior

- **No Locations:** quote calculation is not possible
- **No Rate Cards:** calculation returns Unavailable
- **No Catalog:** user can still add custom items

贡献指南

这个仓库没有索引到贡献指南

调研方向

No files, tests, or existing entry points are identified in the issue. Start by establishing the Python backend service and its HTTP API around the specified data model, calculation rules, quote snapshots, and admin operations. Done means the API supports all listed behaviors, validation, empty-data cases, formatting, and immutable saved quotes.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, backend, database
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。