fixup: insert task without finished at

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-21 00:08:29 +03:00
parent 2702cfd049
commit 45672c2964
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -122,7 +122,7 @@ impl Repository for SqliteRepo {
.conn .conn
.prepare( .prepare(
"INSERT INTO tasks (name, project, link, dir_path, created_at, finished_at) "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)?; .map_err(|_| Error::PrepareQuery)?;
@ -134,6 +134,9 @@ impl Repository for SqliteRepo {
&insert_data &insert_data
.dir_path .dir_path
.and_then(|p| p.into_os_string().into_string().ok()), .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, &insert_data.finished_at,
)) ))
.map_err(|_| Error::InsertData)?; .map_err(|_| Error::InsertData)?;