From 45672c29644ff36c2b5040032ca27436f77cd9e5 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 21 Aug 2022 00:08:29 +0300 Subject: [PATCH] fixup: insert task without finished at --- src/repo/sqlite.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/repo/sqlite.rs b/src/repo/sqlite.rs index 3f3bc30..650fb6a 100644 --- a/src/repo/sqlite.rs +++ b/src/repo/sqlite.rs @@ -122,7 +122,7 @@ impl Repository for SqliteRepo { .conn .prepare( "INSERT INTO tasks (name, project, link, dir_path, created_at, finished_at) - VALUES (?1, ?2, ?3, ?4, ?5, ?5)", + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", ) .map_err(|_| Error::PrepareQuery)?; @@ -134,6 +134,9 @@ impl Repository for SqliteRepo { &insert_data .dir_path .and_then(|p| p.into_os_string().into_string().ok()), + &insert_data + .finished_at + .unwrap_or_else(|| time::OffsetDateTime::now_utc()), &insert_data.finished_at, )) .map_err(|_| Error::InsertData)?;