Merge pull request 'formating-ergo' (#789) from formating-ergo into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 8m11s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

Reviewed-on: #789
This commit is contained in:
philipp 2024-11-11 13:34:31 +01:00
commit c15ed6e9a9
3 changed files with 34 additions and 19 deletions

View File

@ -9,8 +9,12 @@ use serde::Serialize;
use sqlx::{FromRow, Row, SqlitePool};
use super::{
notification::Notification, role::Role, tripdetails::TripDetails, triptype::TripType,
user::User,
log::Log,
notification::Notification,
role::Role,
tripdetails::TripDetails,
triptype::TripType,
user::{EventUser, User},
};
#[derive(Serialize, Clone, FromRow, Debug, PartialEq)]
@ -242,6 +246,7 @@ WHERE trip_details.id=?
pub async fn create(
db: &SqlitePool,
user: &EventUser,
name: &str,
planned_amount_cox: i32,
always_show: bool,
@ -270,6 +275,15 @@ WHERE trip_details.id=?
.execute(db)
.await
.unwrap(); //Okay, as TripDetails can only be created with proper DB backing
Log::create(
db,
format!(
"{} created event {} on {} at {}.",
user.user.name, name, trip_details.day, trip_details.planned_starting_time
),
)
.await;
}
//TODO: create unit test

View File

@ -26,7 +26,7 @@ struct AddEventForm<'r> {
async fn create(
db: &State<SqlitePool>,
data: Form<AddEventForm<'_>>,
_admin: EventUser,
user: EventUser,
) -> Flash<Redirect> {
let data = data.into_inner();
@ -37,6 +37,7 @@ async fn create(
Event::create(
db,
&user,
data.name,
data.planned_amount_cox,
data.always_show,

View File

@ -7,13 +7,15 @@
<summary>Dirty Thirty</summary>
<p>
<div class="border-r border-l">
{% for stat in thirty %}
{% set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}&#9;
{% for name in names %}
<textarea style="width: 100%; height: 300px;">
{%- for stat in thirty %}
{%- set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}&#9;
{%- for name in names -%}
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
{% endfor %}
&#9;{{ stat.dob }}&#9;{{ stat.weight }}&#9;{{ stat.sex }}&#9;&#9;DLI&#9;{{ stat.result }}
{% endfor %}
{%- endfor -%}
&#9;{{ stat.dob }}&#9;{{ stat.weight }}&#9;{{ stat.sex }}&#9;&#9;DLI&#9;{{ stat.result }}&#13;&#10;
{%- endfor -%}
</textarea>
</div>
</p>
</details>
@ -21,17 +23,15 @@
<summary>Dirty Dozen</summary>
<p>
<div class="border-r border-l">
{% for stat in dozen %}
{% set names = stat.name | split(pat=" ") %}
{% set lastname_index = names | length - 1 %}
{% set lastname = names[lastname_index] %}
{{ lastname }};
{% for name in names %}
<textarea style="width: 100%; height: 300px;">
{%- for stat in dozen -%}
{%- set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}&#9;
{%- for name in names -%}
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
{% endfor %}
;{{ stat.dob }};{{ stat.weight }};{{ stat.sex }};DLI;{{ stat.result }}
<br />
{% endfor %}
{%- endfor -%}
&#9;{{ stat.dob }}&#9;{{ stat.weight }}&#9;{{ stat.sex }}&#9;&#9;DLI&#9;{{ stat.result }}&#13;&#10;
{%- endfor -%}
</textarea>
</div>
</p>
</details>