Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a1dd7e4b | ||
|
|
3164fa8048 | ||
|
|
13bbba1053 | ||
|
|
2ff27b2a65 | ||
|
|
f612dbd764 | ||
|
|
262ab07b03 |
No files matched your search
+38
-1
@@ -1,4 +1,4 @@
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use chrono::{DateTime, Duration, Local, Utc};
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
use super::affected;
|
||||
@@ -102,6 +102,43 @@ pub async fn start(pool: &SqlitePool, project_id: i64, note: &str) -> AppResult<
|
||||
get(pool, id).await
|
||||
}
|
||||
|
||||
/// Copies finished entries `days` days later (or earlier), keeping their local
|
||||
/// wall-clock times, project and note. The running entry is skipped. All or
|
||||
/// nothing: an archived project rejects the whole copy. Returns the count.
|
||||
pub async fn duplicate(pool: &SqlitePool, ids: &[i64], days: i64) -> AppResult<usize> {
|
||||
let shift = |dt: &DateTime<Utc>| {
|
||||
clock::local_to_utc(dt.with_timezone(&Local).naive_local() + Duration::days(days))
|
||||
};
|
||||
let mut copies = Vec::new();
|
||||
for &id in ids {
|
||||
let e = get(pool, id).await?;
|
||||
let Some(ended) = e.ended_at else { continue };
|
||||
super::projects::get_active(pool, e.project_id).await?;
|
||||
let (started, ended) = (shift(&e.started_at), shift(&ended));
|
||||
validate_span(&started, Some(&ended))?;
|
||||
copies.push((e.project_id, started, ended, e.note));
|
||||
}
|
||||
if copies.is_empty() {
|
||||
return Err(AppError::Validation(
|
||||
"aucune entrée terminée à copier".into(),
|
||||
));
|
||||
}
|
||||
let mut tx = pool.begin().await?;
|
||||
for (project_id, started, ended, note) in &copies {
|
||||
sqlx::query(
|
||||
"INSERT INTO time_entries (project_id, started_at, ended_at, note) VALUES (?1, ?2, ?3, ?4)",
|
||||
)
|
||||
.bind(project_id)
|
||||
.bind(clock::ts(started))
|
||||
.bind(clock::ts(ended))
|
||||
.bind(note)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
tx.commit().await?;
|
||||
Ok(copies.len())
|
||||
}
|
||||
|
||||
/// Stops the running timer.
|
||||
pub async fn stop(pool: &SqlitePool) -> AppResult<Entry> {
|
||||
let entry = running(pool)
|
||||
|
||||
+70
-7
@@ -46,6 +46,8 @@ pub fn router() -> Router<SqlitePool> {
|
||||
get(entry_row).put(update_entry).delete(delete_entry),
|
||||
)
|
||||
.route("/ui/entries/{id}/edit", get(entry_edit))
|
||||
.route("/ui/entries/{id}/relancer", post(restart_entry))
|
||||
.route("/ui/jours/{date}/dupliquer", post(duplicate_day))
|
||||
.route(
|
||||
"/ui/entries/{id}/dupliquer",
|
||||
get(entry_duplicate).post(duplicate_entry),
|
||||
@@ -99,6 +101,16 @@ fn with_entries_changed(resp: Response) -> Response {
|
||||
(AppendHeaders([("HX-Trigger", "entries-changed")]), resp).into_response()
|
||||
}
|
||||
|
||||
/// Same, plus `timer-changed` so the dashboard timer follows a start/stop
|
||||
/// made elsewhere (header, entry lists).
|
||||
fn with_timer_changed(resp: Response) -> Response {
|
||||
(
|
||||
AppendHeaders([("HX-Trigger", "entries-changed, timer-changed")]),
|
||||
resp,
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
struct ProjectOption {
|
||||
id: i64,
|
||||
name: String,
|
||||
@@ -246,11 +258,33 @@ struct RecentTpl {
|
||||
|
||||
/// Entries started on the same local day, with their total.
|
||||
struct DayGroup {
|
||||
date: NaiveDate,
|
||||
day: String,
|
||||
total: String,
|
||||
entries: Vec<Entry>,
|
||||
}
|
||||
|
||||
impl DayGroup {
|
||||
/// Comma-separated ids of the listed entries, for "copy this day".
|
||||
fn ids(&self) -> String {
|
||||
self.entries
|
||||
.iter()
|
||||
.map(|e| e.id.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join(",")
|
||||
}
|
||||
|
||||
/// Default target of "copy this day": today, or tomorrow for today itself.
|
||||
fn copy_to(&self) -> NaiveDate {
|
||||
let today = clock::today();
|
||||
if self.date == today {
|
||||
today + Duration::days(1)
|
||||
} else {
|
||||
today
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Groups a list sorted by start time into consecutive days.
|
||||
fn group_by_day(list: Vec<Entry>) -> Vec<DayGroup> {
|
||||
let mut days: Vec<(NaiveDate, i64, Vec<Entry>)> = Vec::new();
|
||||
@@ -266,6 +300,7 @@ fn group_by_day(list: Vec<Entry>) -> Vec<DayGroup> {
|
||||
}
|
||||
days.into_iter()
|
||||
.map(|(date, secs, entries)| DayGroup {
|
||||
date,
|
||||
day: clock::fmt_day(date),
|
||||
total: clock::hhmm(secs),
|
||||
entries,
|
||||
@@ -363,13 +398,7 @@ async fn stop_timer(State(pool): State<SqlitePool>) -> PageResult {
|
||||
Ok(_) | Err(AppError::Conflict(_)) => {}
|
||||
Err(e) => return Err(e.into()),
|
||||
}
|
||||
// `timer-changed` refreshes the dashboard timer when stopped from the header.
|
||||
let resp = render(timer_state(&pool).await?)?;
|
||||
Ok((
|
||||
AppendHeaders([("HX-Trigger", "entries-changed, timer-changed")]),
|
||||
resp,
|
||||
)
|
||||
.into_response())
|
||||
Ok(with_timer_changed(render(timer_state(&pool).await?)?))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -727,6 +756,40 @@ async fn update_entry(
|
||||
Ok(with_entries_changed(render(EntryRowTpl { e })?))
|
||||
}
|
||||
|
||||
/// Stops the running timer and starts a new one on this entry's project and note.
|
||||
async fn restart_entry(State(pool): State<SqlitePool>, Path(id): Path<i64>) -> PageResult {
|
||||
let e = entries::get(&pool, id).await?;
|
||||
entries::start(&pool, e.project_id, &e.note).await?;
|
||||
Ok(with_timer_changed(StatusCode::OK.into_response()))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct DuplicateDayForm {
|
||||
/// Comma-separated entry ids.
|
||||
ids: String,
|
||||
vers: NaiveDate,
|
||||
}
|
||||
|
||||
/// Copies the listed entries of `date` to another day, same times.
|
||||
async fn duplicate_day(
|
||||
State(pool): State<SqlitePool>,
|
||||
Path(date): Path<NaiveDate>,
|
||||
Form(f): Form<DuplicateDayForm>,
|
||||
) -> PageResult {
|
||||
if f.vers == date {
|
||||
return Err(AppError::Validation("choisis un autre jour que celui copié".into()).into());
|
||||
}
|
||||
let ids = f
|
||||
.ids
|
||||
.split(',')
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(|s| s.trim().parse::<i64>())
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(|_| AppError::Validation("liste d'entrées invalide".into()))?;
|
||||
entries::duplicate(&pool, &ids, (f.vers - date).num_days()).await?;
|
||||
Ok(with_entries_changed(StatusCode::OK.into_response()))
|
||||
}
|
||||
|
||||
async fn delete_entry(State(pool): State<SqlitePool>, Path(id): Path<i64>) -> PageResult {
|
||||
entries::delete(&pool, id).await?;
|
||||
// htmx swaps the row with this empty body, removing it.
|
||||
|
||||
+7
-1
@@ -99,6 +99,7 @@ a.btn { color: var(--text); text-decoration: none; }
|
||||
.btn:hover { border-color: var(--muted); }
|
||||
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
|
||||
.btn.danger { color: var(--danger); }
|
||||
.btn.play { color: var(--accent); }
|
||||
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
|
||||
.btn.icon {
|
||||
display: inline-flex; align-items: center; justify-content: center; flex: none;
|
||||
@@ -123,6 +124,8 @@ a.btn { color: var(--text); text-decoration: none; }
|
||||
.timer-start { margin-top: .35rem; font-size: .9rem; }
|
||||
.timer-start input { width: 11rem; }
|
||||
.clock { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
.btn.icon.timer-stop { width: 3rem; height: 3rem; border-radius: 50%; }
|
||||
.timer-stop svg { width: 20px; height: 20px; }
|
||||
.start { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: .5rem; }
|
||||
.note { color: var(--muted); font-size: .9rem; }
|
||||
|
||||
@@ -139,6 +142,9 @@ tr:last-child td { border-bottom: 0; }
|
||||
.project-link:hover { color: var(--accent); text-decoration-color: currentColor; }
|
||||
tr.running { background: var(--running); }
|
||||
tr.day-head th { color: var(--text); font-weight: 600; font-size: .9rem; padding-top: 1.1rem; }
|
||||
tr.day-head th.actions { padding-top: .6rem; text-align: right; }
|
||||
tr.day-copy td { background: var(--bg); }
|
||||
tr.day-copy .row { justify-content: flex-end; flex-wrap: wrap; }
|
||||
tbody:first-of-type tr.day-head th { padding-top: .6rem; }
|
||||
tr.editing td { background: var(--bg); }
|
||||
tr.editing input, tr.editing select { width: 100%; }
|
||||
@@ -188,7 +194,7 @@ input[type="color"] {
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.current { grid-template-columns: 1fr auto; }
|
||||
.current .btn { grid-column: 1 / -1; }
|
||||
.current-label { grid-column: 1 / -1; min-width: 0; }
|
||||
.start { grid-template-columns: 1fr; }
|
||||
.report .label { width: auto; }
|
||||
.bar-cell { width: 30%; }
|
||||
|
||||
@@ -57,6 +57,13 @@ document.body.addEventListener("htmx:beforeCleanupElement", (event) => {
|
||||
event.target._flatpickr?.destroy();
|
||||
});
|
||||
|
||||
// Shows/hides the "copy this day" form under a day header.
|
||||
function toggleDayCopy(button) {
|
||||
const row = button.closest("tbody").querySelector(".day-copy");
|
||||
row.hidden = !row.hidden;
|
||||
if (!row.hidden) row.querySelector('input[type="date"]').focus();
|
||||
}
|
||||
|
||||
// Removes a row without a request (e.g. cancelling a duplicate).
|
||||
function removeRow(button) {
|
||||
const row = button.closest("tr");
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
{% import "_icons.html" as icons %}
|
||||
{% for d in days %}
|
||||
<tbody>
|
||||
<tr class="day-head"><th colspan="3">{{ d.day }}</th><th class="num">{{ d.total }}</th><th></th></tr>
|
||||
<tr class="day-head">
|
||||
<th colspan="3">{{ d.day }}</th>
|
||||
<th class="num">{{ d.total }}</th>
|
||||
<th class="actions">
|
||||
<button class="btn small icon" title="Copier cette journée vers un autre jour" aria-label="Copier cette journée vers un autre jour" hx-on:click="toggleDayCopy(this)">{% call icons::icon("copy") %}{% endcall %}</button>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="day-copy" hidden>
|
||||
<td colspan="5">
|
||||
<form class="row" hx-post="/ui/jours/{{ d.date }}/dupliquer" hx-swap="none">
|
||||
<input type="hidden" name="ids" value="{{ d.ids() }}">
|
||||
<label>Copier les entrées du {{ d.day }} vers le <input type="date" name="vers" value="{{ d.copy_to() }}" required></label>
|
||||
<div class="btn-group">
|
||||
<button class="btn small icon primary" title="Copier" aria-label="Copier">{% call icons::icon("check") %}{% endcall %}</button>
|
||||
<button type="button" class="btn small icon" title="Annuler" aria-label="Annuler" hx-on:click="toggleDayCopy(this)">{% call icons::icon("close") %}{% endcall %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% for e in d.entries %}{% include "_entry_row.html" %}{% endfor %}
|
||||
</tbody>
|
||||
{% endfor %}
|
||||
@@ -9,6 +9,11 @@
|
||||
<td class="num">{{ e.duration() }}</td>
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{% if e.running() %}
|
||||
<button class="btn small icon danger" title="Arrêter" aria-label="Arrêter le timer" hx-post="/ui/timer/stop" hx-swap="none">{% call icons::icon("stop") %}{% endcall %}</button>
|
||||
{% else %}
|
||||
<button class="btn small icon play" title="Relancer cette entrée" aria-label="Relancer cette entrée" hx-post="/ui/entries/{{ e.id }}/relancer" hx-swap="none">{% call icons::icon("play") %}{% endcall %}</button>
|
||||
{% endif %}
|
||||
<button class="btn small icon primary" title="Modifier" aria-label="Modifier" hx-get="/ui/entries/{{ e.id }}/edit" hx-target="closest tr" hx-swap="outerHTML">{% call icons::icon("edit") %}{% endcall %}</button>
|
||||
<button class="btn small icon" title="Dupliquer" aria-label="Dupliquer" hx-get="/ui/entries/{{ e.id }}/dupliquer" hx-target="closest tr" hx-swap="afterend">{% call icons::icon("copy") %}{% endcall %}</button>
|
||||
<button class="btn small icon danger" title="Supprimer" aria-label="Supprimer" hx-delete="/ui/entries/{{ e.id }}" hx-target="closest tr" hx-swap="outerHTML" hx-confirm="Supprimer cette entrée ?">{% call icons::icon("trash") %}{% endcall %}</button>
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
{%- else if name == "copy" -%}<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
||||
{%- else if name == "trash" -%}<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/>
|
||||
{%- else if name == "check" -%}<path d="M20 6 9 17l-5-5"/>
|
||||
{%- else if name == "close" -%}<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
||||
{%- else if name == "plus" -%}<path d="M5 12h14"/><path d="M12 5v14"/>
|
||||
{%- else if name == "reset" -%}<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>
|
||||
{%- else if name == "play" -%}<path d="M7 4.5v15l12.5-7.5z" fill="currentColor"/>
|
||||
{%- else if name == "stop" -%}<rect x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor"/>
|
||||
{%- else if name == "link" -%}<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
||||
{%- else if name == "archive" -%}<rect x="2" y="3" width="20" height="5" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"/><path d="M10 12h4"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<section id="recent" class="card" hx-get="/ui/dernieres-entrees" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<section id="recent" hx-disinherit="*" class="card" hx-get="/ui/dernieres-entrees" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<div class="card-head">
|
||||
<h2>Dernières entrées</h2>
|
||||
<a href="/entries">Tout voir</a>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<section id="timer" hx-get="/ui/timer" hx-trigger="timer-changed from:body" hx-swap="outerHTML" class="card timer{% if running.is_some() %} is-running{% endif %}"{% if let Some(e) = running %} style="--color: {{ e.color }}"{% endif %}>
|
||||
{% import "_icons.html" as icons %}
|
||||
<section id="timer" hx-disinherit="*" hx-get="/ui/timer" hx-trigger="timer-changed from:body" hx-swap="outerHTML" class="card timer{% if running.is_some() %} is-running{% endif %}"{% if let Some(e) = running %} style="--color: {{ e.color }}"{% endif %}>
|
||||
{% if let Some(e) = running %}
|
||||
<div class="current">
|
||||
<div class="current-label">
|
||||
@@ -11,7 +12,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="clock" data-started="{{ e.started_rfc3339() }}">{{ e.duration() }}</div>
|
||||
<button class="btn danger" hx-post="/ui/timer/stop" hx-target="#timer" hx-swap="outerHTML">Arrêter</button>
|
||||
<button class="btn icon danger timer-stop" hx-post="/ui/timer/stop" hx-target="#timer" hx-swap="outerHTML" title="Arrêter" aria-label="Arrêter le timer">{% call icons::icon("stop") %}{% endcall %}</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if groups.is_empty() %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<section id="today" class="card" hx-get="/ui/today" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<section id="today" hx-disinherit="*" class="card" hx-get="/ui/today" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<div class="card-head">
|
||||
<h2>Aujourd'hui</h2>
|
||||
<span class="total">{{ today_total }}</span>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section id="entries-list" class="card" hx-get="/entries?from={{ from }}&to={{ to }}{{ extra_query }}" hx-select="#entries-list" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<section id="entries-list" hx-disinherit="*" class="card" hx-get="/entries?from={{ from }}&to={{ to }}{{ extra_query }}" hx-select="#entries-list" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<div class="card-head">
|
||||
<h2>Entrées</h2>
|
||||
<span class="total">{{ total }}</span>
|
||||
|
||||
+127
@@ -802,3 +802,130 @@ 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);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn duplicate_day() {
|
||||
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, 15),
|
||||
)
|
||||
.await; // 1
|
||||
add_entry(
|
||||
&app,
|
||||
b,
|
||||
local(2026, 3, 10, 14, 0),
|
||||
local(2026, 3, 10, 16, 0),
|
||||
)
|
||||
.await; // 2
|
||||
|
||||
// The day header carries the listed ids and posts to the copy route.
|
||||
let (_, html) = get_html(&app, "/entries?from=2026-03-10&to=2026-03-10").await;
|
||||
assert!(html.contains("hx-post=\"/ui/jours/2026-03-10/dupliquer\""));
|
||||
// The self-refreshing list must not pass hx-select & co. down to row buttons
|
||||
// (inline edit would swap in an empty row).
|
||||
assert!(html.contains("id=\"entries-list\" hx-disinherit=\"*\""));
|
||||
assert!(html.contains("name=\"ids\" value=\"2,1\""));
|
||||
|
||||
let (status, _) = send_form(
|
||||
&app,
|
||||
"/ui/jours/2026-03-10/dupliquer",
|
||||
"ids=2,1&vers=2026-03-12",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
let (_, list) = send(
|
||||
&app,
|
||||
"GET",
|
||||
"/api/entries?from=2026-03-12&to=2026-03-12",
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
let list = list.as_array().unwrap();
|
||||
assert_eq!(list.len(), 2);
|
||||
assert_eq!(list[0]["project_id"], b);
|
||||
let parse = |v: &Value| chrono::DateTime::parse_from_rfc3339(v.as_str().unwrap()).unwrap();
|
||||
assert_eq!(
|
||||
parse(&list[1]["started_at"]),
|
||||
parse(&json!(local(2026, 3, 12, 9, 0)))
|
||||
);
|
||||
assert_eq!(list[1]["seconds"], 4500);
|
||||
|
||||
// Same day, or an archived project: refused, nothing copied.
|
||||
let (status, _) = send_form(
|
||||
&app,
|
||||
"/ui/jours/2026-03-10/dupliquer",
|
||||
"ids=1&vers=2026-03-10",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::UNPROCESSABLE_ENTITY);
|
||||
send(
|
||||
&app,
|
||||
"PATCH",
|
||||
&format!("/api/projects/{b}"),
|
||||
Some(json!({ "archived": true })),
|
||||
)
|
||||
.await;
|
||||
let (status, _) = send_form(
|
||||
&app,
|
||||
"/ui/jours/2026-03-10/dupliquer",
|
||||
"ids=2,1&vers=2026-03-13",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::UNPROCESSABLE_ENTITY);
|
||||
let (_, list) = send(
|
||||
&app,
|
||||
"GET",
|
||||
"/api/entries?from=2026-03-13&to=2026-03-13",
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(list.as_array().unwrap().is_empty());
|
||||
}
|
||||
Reference in new issue
Block a user