diff --git a/src/model/boat.rs b/src/model/boat.rs index 5860d32..4106393 100644 --- a/src/model/boat.rs +++ b/src/model/boat.rs @@ -46,6 +46,7 @@ pub struct BoatWithDetails { damage: BoatDamage, on_water: bool, reserved_today: bool, + cat: String, } #[derive(FromForm)] @@ -179,11 +180,18 @@ AND date('now') BETWEEN start_date AND end_date;", if boat.is_locked(db).await { damage = BoatDamage::Locked; } + let cat = if boat.default_shipmaster_only_steering { + format!("{}+", boat.amount_seats - 1) + } else { + format!("{}x", boat.amount_seats) + }; + res.push(BoatWithDetails { damage, on_water: boat.on_water(db).await, reserved_today: boat.reserved_today(db).await, boat, + cat, }); } res diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index 99d308e..c70fb8c 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -3,16 +3,14 @@ Inputs: boats #} {% macro show_boats() %} - {% for amount_seats, grouped_boats in boats | group_by(attribute="amount_seats") %} + {% for amount_seats, grouped_boats in boats | group_by(attribute="cat") %}
{% if grouped_boats[0].external %} Vereinsfremde Boote - {% elif grouped_boats[0].default_shipmaster_only_steering %} - {{ grouped_boats[0].amount_seats - 1 }}+ {% else %} - {{ amount_seats }}x + {{ grouped_boats[0].cat }} {% endif %} ({{ grouped_boats | length }}) @@ -78,7 +76,7 @@ {% endmacro new %} {% macro boat_select(id="boat_id") %} - {{ macros::select(label="Boot", data=boats, name="boat_id", id=id, display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water", "default_destination"], wrapper_class="col-span-4", show_seats=true) }} + {{ macros::select(label="Boot", data=boats, name="boat_id", id=id, display=["name", " (","cat",")"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water", "default_destination"], wrapper_class="col-span-4", show_seats=true) }} {% endmacro boat_select %} {% macro rower_select(id, selected, amount_seats='', class='', init='false', cox_on_boat='', steering_person_id='') %} {#{% if not amount_seats or amount_seats > 1 %}#}