fix(defter): haftalar ayın günlerine göre (1–8, 9–15, 16–22, 23–son), defter bugünün haftasıyla açılır

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 20:31:15 +03:00
parent 233907e3d9
commit 6e1000afd2
15 changed files with 144 additions and 130 deletions
+7 -7
View File
@@ -95,11 +95,11 @@ async fn four_questions_and_breakdowns() {
let culture = category(&app, &s, "culture", 0).await;
// Aralık 2026 haftaları: 1–6 · 7–13 · 14–20 · 21–27 · 28–31
spend(&app, &s, &pid, "2026-12-01", 100_000, &market).await;
spend(&app, &s, &pid, "2026-12-08", 50_000, &market).await;
spend(&app, &s, &pid, "2026-12-08", 300_000, &rent).await;
spend(&app, &s, &pid, "2026-12-15", 40_000, &wants).await;
spend(&app, &s, &pid, "2026-12-09", 50_000, &market).await;
spend(&app, &s, &pid, "2026-12-09", 300_000, &rent).await;
spend(&app, &s, &pid, "2026-12-16", 40_000, &wants).await;
spend(&app, &s, &pid, "2026-12-31", 10_000, &culture).await;
let gone = spend(&app, &s, &pid, "2026-12-15", 99_999, &wants).await;
let gone = spend(&app, &s, &pid, "2026-12-16", 99_999, &wants).await;
app.delete(&format!("/entries/{}", gone["id"].as_str().unwrap()), &s)
.await;
@@ -145,13 +145,13 @@ async fn four_questions_and_breakdowns() {
// Haftalar: 4 grubun toplamı; planlananların toplamı aylık bütçelerin toplamı
assert_eq!(
column(&r["weeks"], "spent"),
vec![100_000, 350_000, 40_000, 0, 10_000]
vec![100_000, 350_000, 40_000, 10_000]
);
assert_eq!(
column(&r["weeks"], "planned").iter().sum::<i64>(),
1_800_000
);
assert_eq!(r["weeks"][4]["last_date"], "2026-12-31");
assert_eq!(r["weeks"][3]["last_date"], "2026-12-31");
app.cleanup().await;
}
@@ -176,7 +176,7 @@ async fn overspending_gives_negative_savings() {
);
// Hiç bütçe yoksa: gruplar 0 planlı, haftalar yine dönem takviminden
assert_eq!(column(&r["groups"], "planned"), vec![0; 4]);
assert_eq!(r["weeks"].as_array().unwrap().len(), 5);
assert_eq!(r["weeks"].as_array().unwrap().len(), 4);
app.cleanup().await;
}