Compare commits
2 Commits
38d4899bf4
...
5cbdb2ae63
Author | SHA1 | Date | |
---|---|---|---|
5cbdb2ae63 | |||
5078c5f341 |
@ -74,8 +74,16 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
|
|||||||
await expect(page.locator("body")).toContainText("Joe");
|
await expect(page.locator("body")).toContainText("Joe");
|
||||||
|
|
||||||
await page.goto("http://localhost:8000/log");
|
await page.goto("http://localhost:8000/log");
|
||||||
await page.waitForTimeout(60000);
|
|
||||||
await page.locator("div:nth-child(2) > .border-0").click();
|
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" }).click();
|
||||||
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
|
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
|
||||||
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();
|
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 expect(page.locator("body")).toContainText("Joe");
|
||||||
|
|
||||||
await page.goto("http://localhost:8000/log");
|
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
|
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" }).click();
|
||||||
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
|
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
|
||||||
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();
|
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
use chrono::{Datelike, NaiveDateTime, Utc};
|
use chrono::{Datelike, Local, NaiveDateTime};
|
||||||
use rocket::FromForm;
|
use rocket::FromForm;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||||
@ -259,7 +259,7 @@ ORDER BY departure DESC
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn completed(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
|
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(
|
let logs = sqlx::query_as(
|
||||||
&format!("
|
&format!("
|
||||||
SELECT id, boat_id, shipmaster, steering_person, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
|
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() {
|
if arr.timestamp() <= dep.timestamp() {
|
||||||
return Err(LogbookUpdateError::ArrivalNotAfterDeparture);
|
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 = today - arr.date();
|
||||||
let day_diff = day_diff.num_days();
|
let day_diff = day_diff.num_days();
|
||||||
if day_diff >= 7 && !user.has_role_tx(db, "admin").await {
|
if day_diff >= 7 && !user.has_role_tx(db, "admin").await {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use chrono::{DateTime, Local, NaiveDateTime, TimeZone, Utc};
|
use chrono::{DateTime, Local, NaiveDateTime, TimeZone};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::{FromRow, SqlitePool};
|
use sqlx::{FromRow, SqlitePool};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ impl Stat {
|
|||||||
pub async fn boats(db: &SqlitePool, year: Option<i32>) -> Vec<Stat> {
|
pub async fn boats(db: &SqlitePool, year: Option<i32>) -> Vec<Stat> {
|
||||||
let year = match year {
|
let year = match year {
|
||||||
Some(year) => 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)
|
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
|
||||||
sqlx::query(&format!(
|
sqlx::query(&format!(
|
||||||
@ -39,7 +39,7 @@ ORDER BY rowed_km DESC;
|
|||||||
pub async fn guest(db: &SqlitePool, year: Option<i32>) -> Stat {
|
pub async fn guest(db: &SqlitePool, year: Option<i32>) -> Stat {
|
||||||
let year = match year {
|
let year = match year {
|
||||||
Some(year) => 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)
|
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
|
||||||
let rowed_km = sqlx::query(&format!(
|
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> {
|
pub async fn people(db: &SqlitePool, year: Option<i32>) -> Vec<Stat> {
|
||||||
let year = match year {
|
let year = match year {
|
||||||
Some(year) => 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)
|
//TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server)
|
||||||
sqlx::query(&format!(
|
sqlx::query(&format!(
|
||||||
|
Loading…
Reference in New Issue
Block a user