Compare commits

..

No commits in common. "e228deb6cd00566d95c1c873cb5c008d70676d06" and "1a2f4c9920c58756ebf0fe1846b2de93274bc8ea" have entirely different histories.

4 changed files with 7 additions and 14 deletions

View File

@ -472,7 +472,7 @@ ORDER BY departure DESC
mut log: LogToFinalize, mut log: LogToFinalize,
) -> Result<(), LogbookUpdateError> { ) -> Result<(), LogbookUpdateError> {
//TODO: extract common tests with `create()` //TODO: extract common tests with `create()`
if !user.has_role_tx(db, "Vorstand").await && user.id != self.shipmaster { if user.id != self.shipmaster {
return Err(LogbookUpdateError::NotYourEntry); return Err(LogbookUpdateError::NotYourEntry);
} }
@ -549,10 +549,7 @@ ORDER BY departure DESC
pub async fn delete(&self, db: &SqlitePool, user: &User) -> Result<(), LogbookDeleteError> { pub async fn delete(&self, db: &SqlitePool, user: &User) -> Result<(), LogbookDeleteError> {
Log::create(db, format!("{user:?} deleted trip: {self:?}")).await; Log::create(db, format!("{user:?} deleted trip: {self:?}")).await;
if user.has_role(db, "admin").await if user.has_role(db, "admin").await || user.id == self.shipmaster {
|| user.has_role(db, "Vorstand").await
|| user.id == self.shipmaster
{
sqlx::query!("DELETE FROM logbook WHERE id=?", self.id) sqlx::query!("DELETE FROM logbook WHERE id=?", self.id)
.execute(db) .execute(db)
.await .await

View File

@ -137,11 +137,9 @@
{{ rower.name }} {{ rower.name }}
{% if rower.id == log.shipmaster or rower.id == log.steering_person %} {% if rower.id == log.shipmaster or rower.id == log.steering_person %}
<small class="text-gray-600 dark:text-primary-100">( <small class="text-gray-600 dark:text-primary-100">(
{%- if rower.id == log.shipmaster %}Schiffsführer {%- if rower.id == log.shipmaster %}Schiffsführer{% endif -%}
{% endif -%} {% if rower.id == log.shipmaster and rower.id == log.steering_person %} / {% endif %}
{% if rower.id == log.shipmaster and rower.id == log.steering_person %}/{% endif %} {%- if rower.id == log.steering_person %}Steuerperson{% endif -%}
{%- if rower.id == log.steering_person %}Steuerperson
{% endif -%}
)</small> )</small>
{% endif %} {% endif %}
</p> </p>

View File

@ -19,8 +19,6 @@
{% for log in on_water %} {% for log in on_water %}
{% if log.shipmaster == loggedin_user.id %} {% if log.shipmaster == loggedin_user.id %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }} {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
{% elif "Vorstand" in loggedin_user.roles %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
{% else %} {% else %}
{{ log::show(log=log, state="on_water", only_ones=true) }} {{ log::show(log=log, state="on_water", only_ones=true) }}
{% endif %} {% endif %}

View File

@ -109,9 +109,9 @@
Uhr Uhr
</strong> </strong>
<small class="text-gray-600 dark:text-gray-100">({{ planned_event.name }} <small class="text-gray-600 dark:text-gray-100">({{ planned_event.name }}
{%- if planned_event.trip_type %} {% if planned_event.trip_type %}
- {{ planned_event.trip_type.icon | safe }} {{ planned_event.trip_type.name }} - {{ planned_event.trip_type.icon | safe }} {{ planned_event.trip_type.name }}
{%- endif -%} {% endif %}
)</small> )</small>
<br /> <br />
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }}) <a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }})