membership-pdf-new #284

Merged
philipp merged 45 commits from membership-pdf-new into staging 2024-03-20 21:05:23 +01:00
4 changed files with 25 additions and 9 deletions
Showing only changes of commit 5cbdb2ae63 - Show all commits

View File

@ -74,8 +74,16 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
await expect(page.locator("body")).toContainText("Joe");
await page.goto("http://localhost:8000/log");
await page.waitForTimeout(60000);
await page.locator("div:nth-child(2) > .border-0").click();
// Add a minute
await page.locator('#arrivaljs').click();
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('ArrowUp');
await page.getByRole("combobox", { name: "Destination" }).click();
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();
@ -149,8 +157,16 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => {
await expect(page.locator("body")).toContainText("Joe");
await page.goto("http://localhost:8000/log");
await page.waitForTimeout(60000);
await page.locator('div:nth-child(2) > .pt-2 > div > div > div:nth-child(2) > .border-0').click(); // 2 trips currently running, try to close second one
// Add a minute
await page.locator('#arrivaljs').click();
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('Tab');
await page.locator('#arrivaljs').press('ArrowUp');
await page.getByRole("combobox", { name: "Destination" }).click();
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();

View File

@ -1,6 +1,6 @@
use std::ops::DerefMut;
use chrono::{Datelike, NaiveDateTime, Utc};
use chrono::{Datelike, Local, NaiveDateTime};
use rocket::FromForm;
use serde::Serialize;
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
@ -259,7 +259,7 @@ ORDER BY departure DESC
}
pub async fn completed(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
let year = chrono::Utc::now().year();
let year = chrono::Local::now().year();
let logs = sqlx::query_as(
&format!("
SELECT id, boat_id, shipmaster, steering_person, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
@ -504,7 +504,7 @@ ORDER BY departure DESC
if arr.timestamp() <= dep.timestamp() {
return Err(LogbookUpdateError::ArrivalNotAfterDeparture);
}
let today = Utc::now().date_naive();
let today = Local::now().date_naive();
let day_diff = today - arr.date();
let day_diff = day_diff.num_days();
if day_diff >= 7 && !user.has_role_tx(db, "admin").await {

View File

@ -1,4 +1,4 @@
use chrono::{DateTime, Local, NaiveDateTime, TimeZone, Utc};
use chrono::{DateTime, Local, NaiveDateTime, TimeZone};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};

View File

@ -13,7 +13,7 @@ impl Stat {
pub async fn boats(db: &SqlitePool, year: Option<i32>) -> Vec<Stat> {
let year = match year {
Some(year) => year,
None => chrono::Utc::now().year(),
None => chrono::Local::now().year(),
};
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
sqlx::query(&format!(
@ -39,7 +39,7 @@ ORDER BY rowed_km DESC;
pub async fn guest(db: &SqlitePool, year: Option<i32>) -> Stat {
let year = match year {
Some(year) => year,
None => chrono::Utc::now().year(),
None => chrono::Local::now().year(),
};
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
let rowed_km = sqlx::query(&format!(
@ -90,7 +90,7 @@ AND l.arrival LIKE '{year}-%';
pub async fn people(db: &SqlitePool, year: Option<i32>) -> Vec<Stat> {
let year = match year {
Some(year) => year,
None => chrono::Utc::now().year(),
None => chrono::Local::now().year(),
};
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
sqlx::query(&format!(