require-user-for-logentry #450
@ -5,6 +5,7 @@ export interface choiceMap {
|
|||||||
[details: string]: Choices;
|
[details: string]: Choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare var loggedin_user_id: string;
|
||||||
let choiceObjects: choiceMap = {};
|
let choiceObjects: choiceMap = {};
|
||||||
let boat_in_ottensheim = true;
|
let boat_in_ottensheim = true;
|
||||||
let boat_reserved_today= true;
|
let boat_reserved_today= true;
|
||||||
@ -176,7 +177,9 @@ function selectBoatChange() {
|
|||||||
/** custom code for Etsch */
|
/** custom code for Etsch */
|
||||||
choiceObjects["newrower"].setChoiceByValue("81");
|
choiceObjects["newrower"].setChoiceByValue("81");
|
||||||
}
|
}
|
||||||
}
|
}else if (typeof loggedin_user_id !== 'undefined'){
|
||||||
|
choiceObjects["newrower"].setChoiceByValue(loggedin_user_id);
|
||||||
|
}
|
||||||
|
|
||||||
const inputElement = document.getElementById(
|
const inputElement = document.getElementById(
|
||||||
"departure",
|
"departure",
|
||||||
|
@ -18,6 +18,7 @@ test("Cox can start and cancel trip", async ({ page }, testInfo) => {
|
|||||||
await page.getByText('2x', { exact: true }).click();
|
await page.getByText('2x', { exact: true }).click();
|
||||||
await page.getByText("Joe", { exact: true }).click();
|
await page.getByText("Joe", { exact: true }).click();
|
||||||
}
|
}
|
||||||
|
await page.getByLabel('Remove item: \'6\'').click(); // remove pre-filled cox2
|
||||||
await page.getByPlaceholder("Ruderer auswählen").click();
|
await page.getByPlaceholder("Ruderer auswählen").click();
|
||||||
await page.getByRole("option", { name: "rower2" }).click();
|
await page.getByRole("option", { name: "rower2" }).click();
|
||||||
await page.getByRole("option", { name: "cox2" }).click();
|
await page.getByRole("option", { name: "cox2" }).click();
|
||||||
@ -59,6 +60,7 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
|
|||||||
await page.getByText('2x', { exact: true }).click();
|
await page.getByText('2x', { exact: true }).click();
|
||||||
await page.getByText("Joe", { exact: true }).click();
|
await page.getByText("Joe", { exact: true }).click();
|
||||||
}
|
}
|
||||||
|
await page.getByLabel('Remove item: \'6\'').click(); // remove pre-filled cox2
|
||||||
await page.getByPlaceholder("Ruderer auswählen").click();
|
await page.getByPlaceholder("Ruderer auswählen").click();
|
||||||
await page.getByRole("option", { name: "rower2" }).click();
|
await page.getByRole("option", { name: "rower2" }).click();
|
||||||
await page.getByRole("option", { name: "cox2" }).click();
|
await page.getByRole("option", { name: "cox2" }).click();
|
||||||
|
@ -250,7 +250,13 @@ async fn create_kiosk(
|
|||||||
} else if let Some(shipmaster) = data.shipmaster {
|
} else if let Some(shipmaster) = data.shipmaster {
|
||||||
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
||||||
} else {
|
} else {
|
||||||
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
|
let Some(rower) = data.rowers.get(0) else {
|
||||||
|
return Flash::error(
|
||||||
|
Redirect::to("/log"),
|
||||||
|
"Ausfahrt ohne Benutzer kann nicht angelegt werden.",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
User::find_by_id(db, *rower as i32).await.unwrap()
|
||||||
};
|
};
|
||||||
Log::create(
|
Log::create(
|
||||||
db,
|
db,
|
||||||
|
@ -38,5 +38,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if loggedin_user %}<script>var loggedin_user_id = "{{ loggedin_user.id }}";</script>{% endif %}
|
||||||
<script src="/public/logbook.js"></script>
|
<script src="/public/logbook.js"></script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
Loading…
Reference in New Issue
Block a user