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)?;