formating-ergo #789
@ -9,8 +9,12 @@ use serde::Serialize;
|
|||||||
use sqlx::{FromRow, Row, SqlitePool};
|
use sqlx::{FromRow, Row, SqlitePool};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
notification::Notification, role::Role, tripdetails::TripDetails, triptype::TripType,
|
log::Log,
|
||||||
user::User,
|
notification::Notification,
|
||||||
|
role::Role,
|
||||||
|
tripdetails::TripDetails,
|
||||||
|
triptype::TripType,
|
||||||
|
user::{EventUser, User},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize, Clone, FromRow, Debug, PartialEq)]
|
#[derive(Serialize, Clone, FromRow, Debug, PartialEq)]
|
||||||
@ -242,6 +246,7 @@ WHERE trip_details.id=?
|
|||||||
|
|
||||||
pub async fn create(
|
pub async fn create(
|
||||||
db: &SqlitePool,
|
db: &SqlitePool,
|
||||||
|
user: &EventUser,
|
||||||
name: &str,
|
name: &str,
|
||||||
planned_amount_cox: i32,
|
planned_amount_cox: i32,
|
||||||
always_show: bool,
|
always_show: bool,
|
||||||
@ -270,6 +275,15 @@ WHERE trip_details.id=?
|
|||||||
.execute(db)
|
.execute(db)
|
||||||
.await
|
.await
|
||||||
.unwrap(); //Okay, as TripDetails can only be created with proper DB backing
|
.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
|
//TODO: create unit test
|
||||||
|
@ -26,7 +26,7 @@ struct AddEventForm<'r> {
|
|||||||
async fn create(
|
async fn create(
|
||||||
db: &State<SqlitePool>,
|
db: &State<SqlitePool>,
|
||||||
data: Form<AddEventForm<'_>>,
|
data: Form<AddEventForm<'_>>,
|
||||||
_admin: EventUser,
|
user: EventUser,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let data = data.into_inner();
|
let data = data.into_inner();
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ async fn create(
|
|||||||
|
|
||||||
Event::create(
|
Event::create(
|
||||||
db,
|
db,
|
||||||
|
&user,
|
||||||
data.name,
|
data.name,
|
||||||
data.planned_amount_cox,
|
data.planned_amount_cox,
|
||||||
data.always_show,
|
data.always_show,
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
<summary>Dirty Thirty</summary>
|
<summary>Dirty Thirty</summary>
|
||||||
<p>
|
<p>
|
||||||
<div class="border-r border-l">
|
<div class="border-r border-l">
|
||||||
{% for stat in thirty %}
|
<textarea style="width: 100%; height: 300px;">
|
||||||
{% set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}	
|
{%- for stat in thirty %}
|
||||||
{% for name in names %}
|
{%- set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}	
|
||||||
|
{%- for name in names -%}
|
||||||
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
|
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
	{{ stat.dob }}	{{ stat.weight }}	{{ stat.sex }}		DLI	{{ stat.result }}
|
	{{ stat.dob }}	{{ stat.weight }}	{{ stat.sex }}		DLI	{{ stat.result }}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
@ -21,17 +23,15 @@
|
|||||||
<summary>Dirty Dozen</summary>
|
<summary>Dirty Dozen</summary>
|
||||||
<p>
|
<p>
|
||||||
<div class="border-r border-l">
|
<div class="border-r border-l">
|
||||||
{% for stat in dozen %}
|
<textarea style="width: 100%; height: 300px;">
|
||||||
{% set names = stat.name | split(pat=" ") %}
|
{%- for stat in dozen -%}
|
||||||
{% set lastname_index = names | length - 1 %}
|
{%- set names = stat.name | split(pat=" ") %}{% set lastname_index = names | length - 1 %}{% set lastname = names[lastname_index] %}{{ lastname }}	
|
||||||
{% set lastname = names[lastname_index] %}
|
{%- for name in names -%}
|
||||||
{{ lastname }};
|
|
||||||
{% for name in names %}
|
|
||||||
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
|
{% if loop.index != lastname_index +1 %}{{ name }}{% endif %}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
;{{ stat.dob }};{{ stat.weight }};{{ stat.sex }};DLI;{{ stat.result }}
|
	{{ stat.dob }}	{{ stat.weight }}	{{ stat.sex }}		DLI	{{ stat.result }}
|
||||||
<br />
|
{%- endfor -%}
|
||||||
{% endfor %}
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
|
Loading…
Reference in New Issue
Block a user