fix
This commit is contained in:
		| @@ -145,6 +145,20 @@ impl From<LogbookUpdateError> for LogbookCreateError { | |||||||
| } | } | ||||||
|  |  | ||||||
| impl Logbook { | impl Logbook { | ||||||
|  |     pub async fn find_by_id_tx(db: &mut Transaction<'_, Sqlite>, id: i32) -> Option<Self> { | ||||||
|  |         sqlx::query_as!( | ||||||
|  |             Self, | ||||||
|  |             " | ||||||
|  |     SELECT id,boat_id,shipmaster,steering_person,shipmaster_only_steering,departure,arrival,destination,distance_in_km,comments,logtype | ||||||
|  |     FROM logbook | ||||||
|  |     WHERE id like ? | ||||||
|  |             ", | ||||||
|  |             id | ||||||
|  |         ) | ||||||
|  |         .fetch_one(db) | ||||||
|  |         .await | ||||||
|  |         .ok() | ||||||
|  |     } | ||||||
|     pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> { |     pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> { | ||||||
|         sqlx::query_as!( |         sqlx::query_as!( | ||||||
|             Self, |             Self, | ||||||
| @@ -273,7 +287,9 @@ ORDER BY departure DESC | |||||||
|             .fetch_one(&mut tx) |             .fetch_one(&mut tx) | ||||||
|             .await.unwrap().id; |             .await.unwrap().id; | ||||||
|  |  | ||||||
|             let logbook = Logbook::find_by_id(db, inserted_row as i32).await.unwrap(); //ok |             let logbook = Logbook::find_by_id_tx(&mut tx, inserted_row as i32) | ||||||
|  |                 .await | ||||||
|  |                 .unwrap(); //ok | ||||||
|  |  | ||||||
|             return match logbook |             return match logbook | ||||||
|                 .home_with_transaction(&mut tx, created_by_user, log_to_finalize) |                 .home_with_transaction(&mut tx, created_by_user, log_to_finalize) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user