Ajoute un bouton play sur les entrées

En tête du groupe d'actions : ▶ arrête le timer en cours et en relance
un sur le même projet et la même note (POST /ui/entries/{id}/relancer) ;
sur l'entrée en cours, ■ l'arrête. Les deux émettent timer-changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-11-13 19:15:06 +01:00
1 parent f612dbd764
commit 2ff27b2a65
5 files changed
+69 -7

No files matched your search

+43
View File
@@ -802,3 +802,46 @@ async fn header_mini_timer() {
let (_, html) = get_html(&app, "/ui/timer/entete").await;
assert!(html.contains("<span class=\"mini-timer-label\">Site web</span>"));
}
#[tokio::test]
async fn restart_entry_from_list() {
let app = app().await;
let a = project(&app, "Acme", "Site web").await;
let b = project(&app, "Globex", "API").await;
add_entry(&app, a, local(2026, 3, 10, 9, 0), local(2026, 3, 10, 10, 0)).await;
send(
&app,
"PATCH",
"/api/entries/1",
Some(json!({ "note": "réunion" })),
)
.await;
send(
&app,
"POST",
"/api/timer/start",
Some(json!({ "project_id": b })),
)
.await;
// ▶ on entry 1: the Globex timer stops, a new one runs on Acme / "réunion".
let (status, _) = send_form(&app, "/ui/entries/1/relancer", "").await;
assert_eq!(status, StatusCode::OK);
let (_, running) = send(&app, "GET", "/api/timer", None).await;
assert_eq!(running["project_id"], a);
assert_eq!(running["note"], "réunion");
let (_, list) = send(
&app,
"GET",
"/api/entries?from=2020-01-01&to=2100-01-01",
None,
)
.await;
let open = list
.as_array()
.unwrap()
.iter()
.filter(|e| e["ended_at"].is_null())
.count();
assert_eq!(open, 1);
}