Set last_opened of new sheets to now

Makes them appear at the top of the list
This commit is contained in:
Julian Mutter 2024-05-25 21:30:08 +02:00
parent 7cce6409b7
commit cfb3cc9835

View File

@ -2,7 +2,6 @@ use crate::{
database::Database,
sheet::{I64DateTime, Pdf, Sheet, SheetKind, SheetKindDiscriminants},
};
use chrono::{DateTime, Utc};
use sqlx::{sqlite::SqliteRow, Row};
use std::path::{Path, PathBuf};
use strum::IntoEnumIterator;
@ -12,7 +11,7 @@ pub async fn insert_file_as_orphan(
file: impl AsRef<Path>,
) -> sqlx::Result<Sheet> {
let pdf = Pdf::try_from(file.as_ref().to_path_buf()).unwrap();
let last_opened = DateTime::<Utc>::default();
let last_opened = chrono::offset::Utc::now();
let result = sqlx::query(
"