Compare commits

...

4 Commits

Author SHA1 Message Date
6e41758104 Merge pull request 'allow-event-triptype-update' (#569) from allow-event-triptype-update into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m30s
CI/CD Pipeline / deploy-staging (push) Successful in 6m16s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #569
2024-06-04 08:32:54 +02:00
ab88ce3230 fix tests
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m15s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-06-04 08:13:24 +02:00
30a6bc7109 allow event trip_type update
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled
2024-06-04 08:12:20 +02:00
99409f9407 Merge pull request 'remove space' (#568) from fix-spaces into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m0s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 6m42s
Reviewed-on: #568
2024-06-02 14:53:14 +02:00
4 changed files with 8 additions and 1 deletions

View File

@ -105,6 +105,7 @@ pub struct EventUpdate<'a> {
pub notes: Option<&'a str>,
pub always_show: bool,
pub is_locked: bool,
pub trip_type_id: Option<i64>,
}
impl Event {
@ -244,11 +245,12 @@ WHERE trip_details.id=?
let was_already_cancelled = tripdetails.max_people == 0;
sqlx::query!(
"UPDATE trip_details SET max_people = ?, notes = ?, always_show = ?, is_locked = ? WHERE id = ?",
"UPDATE trip_details SET max_people = ?, notes = ?, always_show = ?, is_locked = ?, trip_type_id = ? WHERE id = ?",
update.max_people,
update.notes,
update.always_show,
update.is_locked,
update.trip_type_id,
self.trip_details_id
)
.execute(db)

View File

@ -238,6 +238,7 @@ mod test {
notes: event.notes.as_deref(),
always_show: event.always_show,
is_locked: event.is_locked,
trip_type_id: None,
};
event.update(&pool, &cancel_update).await;
@ -267,6 +268,7 @@ mod test {
notes: event.notes.as_deref(),
always_show: event.always_show,
is_locked: event.is_locked,
trip_type_id: None,
};
event.update(&pool, &update).await;
assert!(Notification::for_user(&pool, &rower).await.is_empty());

View File

@ -49,6 +49,7 @@ struct UpdateEventForm<'r> {
notes: Option<&'r str>,
always_show: bool,
is_locked: bool,
trip_type: Option<i64>,
}
#[put("/planned-event", data = "<data>")]
@ -64,6 +65,7 @@ async fn update(
notes: data.notes,
always_show: data.always_show,
is_locked: data.is_locked,
trip_type_id: data.trip_type,
};
match Event::find_by_id(db, data.id).await {
Some(planned_event) => {

View File

@ -220,6 +220,7 @@
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=event.planned_amount_cox, required=true, min='0') }}
{{ macros::checkbox(label='Immer anzeigen', name='always_show', id=event.id,checked=event.always_show) }}
{{ macros::checkbox(label='Gesperrt', name='is_locked', id=event.id,checked=event.is_locked) }}
{{ macros::select(label='Typ', name='trip_type', data=trip_types, default='Reguläre Ausfahrt', selected_id=event.trip_type_id) }}
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=event.notes) }}
<input value="Speichern" class="btn btn-primary" type="submit" />
</form>