Compare commits

...

2 Commits

Author SHA1 Message Date
5eadfd42bb don't show link if the user has no permission
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2024-04-24 17:18:57 +02:00
87307378c6 no special treatment for 'externes boot' 2024-04-24 17:15:53 +02:00
6 changed files with 13 additions and 10 deletions

View File

@ -27,7 +27,7 @@ pub struct Boat {
#[serde(default = "bool::default")] #[serde(default = "bool::default")]
skull: bool, skull: bool,
#[serde(default = "bool::default")] #[serde(default = "bool::default")]
external: bool, pub external: bool,
pub deleted: bool, pub deleted: bool,
} }

View File

@ -582,13 +582,13 @@ ORDER BY departure DESC
).await; ).await;
} }
if boat.name == "Externes Boot" { if boat.external {
let vorstand = Role::find_by_name_tx(db, "Vorstand").await.unwrap(); let vorstand = Role::find_by_name_tx(db, "Vorstand").await.unwrap();
Notification::create_for_role_tx( Notification::create_for_role_tx(
db, db,
&vorstand, &vorstand,
&format!("'{}' hat eine Ausfahrt mit *Externem Boot* am {} eingetragen ({} km; Ziel: {}; Anmerkungen: {}). Falls das nicht stimmen sollte, bitte nachhaken.",user.name,log.departure,log.distance_in_km, log.destination, log.comments.unwrap_or("".into())), &format!("'{}' hat eine Ausfahrt mit externem Boot '{}' am {} eingetragen ({} km; Ziel: {}; Anmerkungen: {}). Falls das nicht stimmen sollte, bitte nachhaken.",user.name,boat.name,log.departure,log.distance_in_km, log.destination, log.comments.unwrap_or("".into())),
"Ausfahrt mit externem Boot eingetragen", "Ausfahrt mit externem Boot eingetragen",
None, None,
).await; ).await;

View File

@ -40,7 +40,7 @@ LEFT JOIN
LEFT JOIN LEFT JOIN
location ON boat.location_id = location.id location ON boat.location_id = location.id
WHERE WHERE
boat.name != 'Externes Boot' AND not boat.external not boat.external
GROUP BY GROUP BY
boat.id, year boat.id, year
ORDER BY ORDER BY
@ -115,7 +115,7 @@ LEFT JOIN (
FROM rower FROM rower
GROUP BY logbook_id GROUP BY logbook_id
) m ON l.id = m.logbook_id ) m ON l.id = m.logbook_id
WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND b.name != 'Externes Boot'; WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND not b.external;
" "
)) ))
.fetch_one(db) .fetch_one(db)

View File

@ -27,7 +27,7 @@ async fn index(
let boats = Boat::all_for_boatshouse(db).await; let boats = Boat::all_for_boatshouse(db).await;
let mut final_boats = Vec::new(); let mut final_boats = Vec::new();
for boat in boats { for boat in boats {
if boat.boat.boathouse(db).await.is_none() && boat.boat.name != "Externes Boot" { if boat.boat.boathouse(db).await.is_none() && !boat.boat.external {
final_boats.push(boat); final_boats.push(boat);
} }
} }

View File

@ -7,8 +7,11 @@
{% set aisle = aisle_name ~ "-aisle" %} {% set aisle = aisle_name ~ "-aisle" %}
{% set place = boathouse[aisle][side_name] %} {% set place = boathouse[aisle][side_name] %}
{% if place[level] %} {% if place[level] %}
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0" {{ place[level].1.name }}
href="/board/boathouse/{{ place[level].0 }}/delete">X</a> {% if "admin" in loggedin_user.roles %}
<a class="btn btn-primary absolute end-0"
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
{% endif %}
{% elif boats | length > 0 %} {% elif boats | length > 0 %}
{% if "admin" in loggedin_user.roles %} {% if "admin" in loggedin_user.roles %}
<details> <details>

View File

@ -228,9 +228,9 @@
{{ rower.name }} {{ rower.name }}
{%- if rower.id == log.steering_user.id and rower.id != log.shipmaster_user.id %} {%- if rower.id == log.steering_user.id and rower.id != log.shipmaster_user.id %}
(Steuerperson){%- endif -%} (Steuerperson){%- endif -%}
{%- if not loop.last or amount_guests > 0 and log.boat.name != 'Externes Boot' %},{% endif %} {%- if not loop.last or amount_guests > 0 and not log.boat.external %},{% endif %}
{% endfor -%} {% endfor -%}
{% if amount_guests > 0 and log.boat.name != 'Externes Boot' %} {% if amount_guests > 0 and not log.boat.external %}
Gäste Gäste
<small class="text-gray-600 dark:text-gray-100">(ohne Account)</small>: <small class="text-gray-600 dark:text-gray-100">(ohne Account)</small>:
{{ amount_guests }} {{ amount_guests }}