feat: Add average order completion time and completion rate metrics to public order listings
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 292
- Forks
- 136
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
## Summary
Add two per-user metrics: the average time to complete an order (from taken to `SUCCESS`) and the completion rate (percentage of taken orders that reached `SUCCESS`). Both are stored on the User model and displayed in the public channel alongside the order.
## Motivation
When two sellers (or buyers) offer identical terms, there is no way to distinguish them by reliability or speed. A visible completion time and completion rate give users meaningful signals to pick the better counterparty, improving overall trade quality and velocity on the platform.
## Proposed UX
Order listing in the channel would include two new lines:
```
⚡ Sell 100,000 sats
💵 1,000 USD — Bank transfer
👤 @alice ⏱ avg. completion: 12 min ✅ 89% completion rate
```
If the user has fewer than 5 completed orders:
```
👤 @bob ⏱ new trader
```
## Data Model Changes
New fields added to the User model:
- `avg_completion_time` — average time in seconds from order taken to `SUCCESS`
- `total_taken_orders` — total number of orders the user has taken, used as the completion rate denominator
The existing `trades_completed` field is reused as the completion rate numerator.
## Calculation Logic
**Completion rate** — recalculated on every `SUCCESS` transition:
```
completionRate = (trades_completed / total_taken_orders) * 100
```
**Average completion time** — updated on every `SUCCESS` transition using a running average, where elapsed time is measured from `order.taken_at` to the moment the order completes.
## Display Logic
- `trades_completed >= 5` → show both metrics alongside the order in the channel
- `trades_completed < 5` → show `new trader` or omit both metrics entirely
## Localization
New keys needed in all `locales/` files:
- `avg_completion_time` — e.g. "⏱ avg. completion: {{time}} min"
- `completion_rate` — e.g. "✅ {{rate}}% completion rate"
- `new_trader` — e.g. "⏱ new trader"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the User model, the order transition to SUCCESS, and the public channel order-listing renderer. Review every file under locales/ for the required keys. Done means completion metrics are stored and updated correctly, the new-trader fallback and metric display follow the five-order threshold, and all locales contain the new strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, database, localization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100