Merge branch 'fix-error-diff-sqlite-version' into 'staging'

fix error on diff sqlite version

See merge request PhilippHofer/rot!18
This commit is contained in:
PhilippHofer 2023-07-30 20:18:11 +00:00
commit 4fe17284bb

View File

@ -85,18 +85,33 @@ impl Logbook {
} }
pub async fn on_water(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> { pub async fn on_water(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
let logs = sqlx::query_as!( let rows = sqlx::query!(
Logbook, "
" SELECT id, boat_id, shipmaster, shipmaster_only_steering, strftime('%Y-%m-%d %H:%M', departure) as departure, arrival, destination, distance_in_km, comments, logtype
SELECT id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype FROM logbook
FROM logbook WHERE arrival is null
WHERE arrival is null ORDER BY departure DESC
ORDER BY departure DESC "
" )
) .fetch_all(db)
.fetch_all(db) .await
.await .unwrap(); //TODO: fixme
.unwrap(); //TODO: fixme
let logs: Vec<Logbook> = rows
.into_iter()
.map(|row| Logbook {
id: row.id,
boat_id: row.boat_id,
shipmaster: row.shipmaster,
shipmaster_only_steering: row.shipmaster_only_steering,
departure: row.departure.unwrap(),
arrival: row.arrival,
destination: row.destination,
distance_in_km: row.distance_in_km,
comments: row.comments,
logtype: row.logtype,
})
.collect();
let mut ret = Vec::new(); let mut ret = Vec::new();
for log in logs { for log in logs {