feat(panel): harcanabilir ve grup harcama grafikleri
- Günlük / Haftalık / Aylık sekmeli iki çizgi grafik (Recharts, ayrı parça olarak yüklenir) - Kümülatif harcanabilir vs gerçekleşen; 4 grup (+ isteğe bağlı harcanabilir çizgisi) - Dönem istatistiklerine grup kırılımı (spent_by_group) - Grafik altında metin özeti, koyu tema uyumlu renkler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -123,7 +123,9 @@ async fn period_stats_and_total_savings() {
|
||||
let s = app.register("Test", None).await;
|
||||
let (nov, dec) = two_periods(&app, &s).await;
|
||||
let needs = category(&app, &s, "needs").await;
|
||||
let culture = category(&app, &s, "culture").await;
|
||||
spend(&app, &s, &dec, "2026-12-05", 40_000, &needs).await;
|
||||
spend(&app, &s, &dec, "2026-12-06", 2_500, &culture).await;
|
||||
|
||||
let (st, b) = app.get("/stats/periods", &s).await;
|
||||
assert_eq!(st, StatusCode::OK, "{b}");
|
||||
@@ -135,6 +137,10 @@ async fn period_stats_and_total_savings() {
|
||||
assert_eq!(list[0]["status"], "closed");
|
||||
assert_eq!(list[0]["spendable"], 1_000_000);
|
||||
assert_eq!(list[0]["spent"], 300_000);
|
||||
assert_eq!(
|
||||
list[0]["spent_by_group"],
|
||||
json!({ "needs": 300_000, "wants": 0, "culture": 0, "unexpected": 0 })
|
||||
);
|
||||
assert_eq!(list[0]["to_savings"], 500_000);
|
||||
assert_eq!(list[0]["last_date"], "2026-11-30");
|
||||
assert_eq!(list[1]["id"], dec.as_str());
|
||||
@@ -142,7 +148,9 @@ async fn period_stats_and_total_savings() {
|
||||
list[1]["spendable"], 2_100_000,
|
||||
"20.000 − 1.000 hedef + 2.000 artı"
|
||||
);
|
||||
assert_eq!(list[1]["spent"], 40_000);
|
||||
assert_eq!(list[1]["spent"], 42_500);
|
||||
assert_eq!(list[1]["spent_by_group"]["needs"], 40_000);
|
||||
assert_eq!(list[1]["spent_by_group"]["culture"], 2_500);
|
||||
assert_eq!(list[1]["to_savings"], Value::Null);
|
||||
|
||||
// limit: en yeni N dönem
|
||||
|
||||
Reference in New Issue
Block a user