diff --git a/db/.sqlx/query-b259a464a99501cb60551791af069f662da9fed90243ac4a42d1cf1020b614d3.json b/db/.sqlx/query-1c9bb8c34c501a3a24708b14d93a3889a11c37dfab085cd777db859ff28b519b.json similarity index 57% rename from db/.sqlx/query-b259a464a99501cb60551791af069f662da9fed90243ac4a42d1cf1020b614d3.json rename to db/.sqlx/query-1c9bb8c34c501a3a24708b14d93a3889a11c37dfab085cd777db859ff28b519b.json index 1b7e0740..f23e8e0b 100644 --- a/db/.sqlx/query-b259a464a99501cb60551791af069f662da9fed90243ac4a42d1cf1020b614d3.json +++ b/db/.sqlx/query-1c9bb8c34c501a3a24708b14d93a3889a11c37dfab085cd777db859ff28b519b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO event (startTimestamp, endTimestamp, name, locationId, voluntaryWachhabender, voluntaryFuehrungsassistent, amountOfPosten, clothing, note)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);\n ", + "query": "\n INSERT INTO event (startTimestamp, endTimestamp, name, locationId, voluntaryWachhabender, fuehrungsassistentRequired, amountOfPosten, clothing, note)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);\n ", "describe": { "columns": [], "parameters": { @@ -18,5 +18,5 @@ }, "nullable": [] }, - "hash": "b259a464a99501cb60551791af069f662da9fed90243ac4a42d1cf1020b614d3" + "hash": "1c9bb8c34c501a3a24708b14d93a3889a11c37dfab085cd777db859ff28b519b" } diff --git a/db/.sqlx/query-ee7abc2204854f5934e683d732493037de6b72d3311f10fa0cf74b7ce7ae11bf.json b/db/.sqlx/query-1ff3f7006fd5594586c2c5c8604e92cf350c1649c02d8355c9ed600385f6b096.json similarity index 68% rename from db/.sqlx/query-ee7abc2204854f5934e683d732493037de6b72d3311f10fa0cf74b7ce7ae11bf.json rename to db/.sqlx/query-1ff3f7006fd5594586c2c5c8604e92cf350c1649c02d8355c9ed600385f6b096.json index 9a995875..2f7d1202 100644 --- a/db/.sqlx/query-ee7abc2204854f5934e683d732493037de6b72d3311f10fa0cf74b7ce7ae11bf.json +++ b/db/.sqlx/query-1ff3f7006fd5594586c2c5c8604e92cf350c1649c02d8355c9ed600385f6b096.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE event SET startTimestamp = $1, endTimestamp = $2, name = $3, locationId = $4, voluntaryWachhabender = $5, voluntaryFuehrungsassistent = $6, amountOfPosten = $7, clothing = $8, note = $9 WHERE id = $10;\n ", + "query": "\n UPDATE event SET startTimestamp = $1, endTimestamp = $2, name = $3, locationId = $4, voluntaryWachhabender = $5, fuehrungsassistentRequired = $6, amountOfPosten = $7, clothing = $8, note = $9 WHERE id = $10;\n ", "describe": { "columns": [], "parameters": { @@ -19,5 +19,5 @@ }, "nullable": [] }, - "hash": "ee7abc2204854f5934e683d732493037de6b72d3311f10fa0cf74b7ce7ae11bf" + "hash": "1ff3f7006fd5594586c2c5c8604e92cf350c1649c02d8355c9ed600385f6b096" } diff --git a/db/.sqlx/query-8a9f517c18b13e6cbf47404d69c2e1c59660250aa5d1074d4da9c0589d0a6bb3.json b/db/.sqlx/query-2975aea80c391b613e9c12ae5f2802806688720e03f0df81b6dc5c79c7642133.json similarity index 64% rename from db/.sqlx/query-8a9f517c18b13e6cbf47404d69c2e1c59660250aa5d1074d4da9c0589d0a6bb3.json rename to db/.sqlx/query-2975aea80c391b613e9c12ae5f2802806688720e03f0df81b6dc5c79c7642133.json index 997e93be..b31b4b72 100644 --- a/db/.sqlx/query-8a9f517c18b13e6cbf47404d69c2e1c59660250aa5d1074d4da9c0589d0a6bb3.json +++ b/db/.sqlx/query-2975aea80c391b613e9c12ae5f2802806688720e03f0df81b6dc5c79c7642133.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n event.starttimestamp,\n event.endtimestamp,\n event.amountofposten,\n event.voluntaryfuehrungsassistent,\n event.voluntarywachhabender,\n location.name AS locationName,\n event.name AS eventName,\n array (\n SELECT\n row (user_.name, assignment.function) ::simpleAssignment\n FROM\n assignment\n JOIN availability on\n assignment.availabilityid = availability.id\n JOIN user_ on\n availability.userid = user_.id\n WHERE\n assignment.eventId = event.id) AS \"assignments: Vec\",\n array (\n SELECT\n vehicle.station || ' ' || vehicle.radiocallname\n FROM\n vehicleassignment\n JOIN vehicle on\n vehicleassignment.vehicleId = vehicle.id\n WHERE\n vehicleassignment.eventId = event.id) AS vehicles\n FROM\n event\n JOIN location on\n event.locationId = location.id\n WHERE\n event.starttimestamp::date >= $1\n AND event.starttimestamp::date <= $2\n AND location.areaId = $3\n ORDER BY\n event.starttimestamp\n", + "query": "SELECT\n event.starttimestamp,\n event.endtimestamp,\n event.amountofposten,\n event.fuehrungsassistentrequired,\n event.voluntarywachhabender,\n location.name AS locationName,\n event.name AS eventName,\n array (\n SELECT\n row (user_.name, assignment.function) ::simpleAssignment\n FROM\n assignment\n JOIN availability on\n assignment.availabilityid = availability.id\n JOIN user_ on\n availability.userid = user_.id\n WHERE\n assignment.eventId = event.id) AS \"assignments: Vec\",\n array (\n SELECT\n vehicle.station || ' ' || vehicle.radiocallname\n FROM\n vehicleassignment\n JOIN vehicle on\n vehicleassignment.vehicleId = vehicle.id\n WHERE\n vehicleassignment.eventId = event.id) AS vehicles\n FROM\n event\n JOIN location on\n event.locationId = location.id\n WHERE\n event.starttimestamp::date >= $1\n AND event.starttimestamp::date <= $2\n AND location.areaId = $3\n ORDER BY\n event.starttimestamp\n", "describe": { "columns": [ { @@ -20,7 +20,7 @@ }, { "ordinal": 3, - "name": "voluntaryfuehrungsassistent", + "name": "fuehrungsassistentrequired", "type_info": "Bool" }, { @@ -102,5 +102,5 @@ null ] }, - "hash": "8a9f517c18b13e6cbf47404d69c2e1c59660250aa5d1074d4da9c0589d0a6bb3" + "hash": "2975aea80c391b613e9c12ae5f2802806688720e03f0df81b6dc5c79c7642133" } diff --git a/db/.sqlx/query-4ceb2c7e3d921c2718e75ba131eee1706e008b783deb687e04eba08f4b919ac8.json b/db/.sqlx/query-32d009eb1d61484466cfbb8bc77cd3d965a1e52c73f5b9d92df4e956286b06a6.json similarity index 73% rename from db/.sqlx/query-4ceb2c7e3d921c2718e75ba131eee1706e008b783deb687e04eba08f4b919ac8.json rename to db/.sqlx/query-32d009eb1d61484466cfbb8bc77cd3d965a1e52c73f5b9d92df4e956286b06a6.json index 588874db..f06f11d5 100644 --- a/db/.sqlx/query-4ceb2c7e3d921c2718e75ba131eee1706e008b783deb687e04eba08f4b919ac8.json +++ b/db/.sqlx/query-32d009eb1d61484466cfbb8bc77cd3d965a1e52c73f5b9d92df4e956286b06a6.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.voluntaryFuehrungsassistent,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE starttimestamp::date = $1\n AND location.areaId = $2;\n ", + "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.fuehrungsassistentRequired,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE starttimestamp::date = $1\n AND location.areaId = $2;\n ", "describe": { "columns": [ { @@ -35,7 +35,7 @@ }, { "ordinal": 6, - "name": "voluntaryfuehrungsassistent", + "name": "fuehrungsassistentrequired", "type_info": "Bool" }, { @@ -109,5 +109,5 @@ false ] }, - "hash": "4ceb2c7e3d921c2718e75ba131eee1706e008b783deb687e04eba08f4b919ac8" + "hash": "32d009eb1d61484466cfbb8bc77cd3d965a1e52c73f5b9d92df4e956286b06a6" } diff --git a/db/.sqlx/query-65367483e39e07cd0aa142f9bb76c7a5d6dd0611e6b41edd5a593c9f955b5d04.json b/db/.sqlx/query-fb4edba6e7bffb9f61c9d825c57f445d0dd79705531c367277b19bbecedff3e3.json similarity index 71% rename from db/.sqlx/query-65367483e39e07cd0aa142f9bb76c7a5d6dd0611e6b41edd5a593c9f955b5d04.json rename to db/.sqlx/query-fb4edba6e7bffb9f61c9d825c57f445d0dd79705531c367277b19bbecedff3e3.json index 88b15e01..6356a3ad 100644 --- a/db/.sqlx/query-65367483e39e07cd0aa142f9bb76c7a5d6dd0611e6b41edd5a593c9f955b5d04.json +++ b/db/.sqlx/query-fb4edba6e7bffb9f61c9d825c57f445d0dd79705531c367277b19bbecedff3e3.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.voluntaryFuehrungsassistent,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE starttimestamp::date >= $1\n AND starttimestamp::date <= $2\n AND location.areaId = $3\n ORDER BY event.starttimestamp;\n ", + "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.fuehrungsassistentRequired,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE starttimestamp::date >= $1\n AND starttimestamp::date <= $2\n AND location.areaId = $3\n ORDER BY event.starttimestamp;\n ", "describe": { "columns": [ { @@ -35,7 +35,7 @@ }, { "ordinal": 6, - "name": "voluntaryfuehrungsassistent", + "name": "fuehrungsassistentrequired", "type_info": "Bool" }, { @@ -110,5 +110,5 @@ false ] }, - "hash": "65367483e39e07cd0aa142f9bb76c7a5d6dd0611e6b41edd5a593c9f955b5d04" + "hash": "fb4edba6e7bffb9f61c9d825c57f445d0dd79705531c367277b19bbecedff3e3" } diff --git a/db/.sqlx/query-6dc18993de451d1e0aa4080f00f46ce3339e020922b9ef130c4289b080a2af7d.json b/db/.sqlx/query-ffb7d4117a008368ab3f1c63118b0fea13eda90942246e65d1bd803dbc5585b1.json similarity index 74% rename from db/.sqlx/query-6dc18993de451d1e0aa4080f00f46ce3339e020922b9ef130c4289b080a2af7d.json rename to db/.sqlx/query-ffb7d4117a008368ab3f1c63118b0fea13eda90942246e65d1bd803dbc5585b1.json index 372b7801..7fc63e62 100644 --- a/db/.sqlx/query-6dc18993de451d1e0aa4080f00f46ce3339e020922b9ef130c4289b080a2af7d.json +++ b/db/.sqlx/query-ffb7d4117a008368ab3f1c63118b0fea13eda90942246e65d1bd803dbc5585b1.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.voluntaryFuehrungsassistent,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE event.id = $1;\n ", + "query": "\n SELECT\n event.id AS eventId,\n event.startTimestamp,\n event.endTimestamp,\n event.name,\n event.locationId,\n event.voluntaryWachhabender,\n event.fuehrungsassistentRequired,\n event.amountOfPosten,\n event.clothing,\n event.canceled,\n event.note,\n location.id,\n location.name AS locationName,\n location.areaId AS locationAreaId,\n clothing.id AS clothingId,\n clothing.name AS clothingName\n FROM event\n JOIN location ON event.locationId = location.id\n JOIN clothing ON event.clothing = clothing.id\n WHERE event.id = $1;\n ", "describe": { "columns": [ { @@ -35,7 +35,7 @@ }, { "ordinal": 6, - "name": "voluntaryfuehrungsassistent", + "name": "fuehrungsassistentrequired", "type_info": "Bool" }, { @@ -108,5 +108,5 @@ false ] }, - "hash": "6dc18993de451d1e0aa4080f00f46ce3339e020922b9ef130c4289b080a2af7d" + "hash": "ffb7d4117a008368ab3f1c63118b0fea13eda90942246e65d1bd803dbc5585b1" } diff --git a/db/migrations/20250714151924_rename_voluntary_fuehrungsassistent.sql b/db/migrations/20250714151924_rename_voluntary_fuehrungsassistent.sql new file mode 100644 index 00000000..2a135262 --- /dev/null +++ b/db/migrations/20250714151924_rename_voluntary_fuehrungsassistent.sql @@ -0,0 +1,2 @@ +ALTER TABLE event + RENAME COLUMN voluntaryFuehrungsassistent TO fuehrungsassistentRequired; diff --git a/db/sql/export_event_row/read_all_by_timerange_and_area.sql b/db/sql/export_event_row/read_all_by_timerange_and_area.sql index 3dff6a74..0f873e88 100644 --- a/db/sql/export_event_row/read_all_by_timerange_and_area.sql +++ b/db/sql/export_event_row/read_all_by_timerange_and_area.sql @@ -2,7 +2,7 @@ SELECT event.starttimestamp, event.endtimestamp, event.amountofposten, - event.voluntaryfuehrungsassistent, + event.fuehrungsassistentrequired, event.voluntarywachhabender, location.name AS locationName, event.name AS eventName, diff --git a/db/src/models/assignment_changeset.rs b/db/src/models/assignment_changeset.rs index aaba0302..3fbb4747 100644 --- a/db/src/models/assignment_changeset.rs +++ b/db/src/models/assignment_changeset.rs @@ -128,7 +128,7 @@ async fn event_has_free_slot_for_function( if match *value { Function::Posten => assignments_with_function >= event.amount_of_posten as usize, Function::Fuehrungsassistent => { - event.voluntary_fuehrungsassistent && assignments_with_function >= 1 + event.fuehrungsassistent_required && assignments_with_function >= 1 } Function::Wachhabender => event.voluntary_wachhabender && assignments_with_function >= 1, } { diff --git a/db/src/models/event.rs b/db/src/models/event.rs index 305616b3..7d255753 100644 --- a/db/src/models/event.rs +++ b/db/src/models/event.rs @@ -12,7 +12,7 @@ pub struct Event { pub location_id: i32, pub location: Option, pub voluntary_wachhabender: bool, - pub voluntary_fuehrungsassistent: bool, + pub fuehrungsassistent_required: bool, pub amount_of_posten: i16, pub clothing: Clothing, pub canceled: bool, @@ -22,10 +22,10 @@ pub struct Event { impl Event { pub async fn create(pool: &PgPool, changeset: EventChangeset) -> Result<()> { query!(r#" - INSERT INTO event (startTimestamp, endTimestamp, name, locationId, voluntaryWachhabender, voluntaryFuehrungsassistent, amountOfPosten, clothing, note) + INSERT INTO event (startTimestamp, endTimestamp, name, locationId, voluntaryWachhabender, fuehrungsassistentRequired, amountOfPosten, clothing, note) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9); "#, - changeset.time.0.and_utc(), changeset.time.1.and_utc(), changeset.name, changeset.location_id, changeset.voluntary_wachhabender, changeset.voluntary_fuehrungsassistent, changeset.amount_of_posten, changeset.clothing, changeset.note).execute(pool).await?; + changeset.time.0.and_utc(), changeset.time.1.and_utc(), changeset.name, changeset.location_id, changeset.voluntary_wachhabender, changeset.fuehrungsassistent_required, changeset.amount_of_posten, changeset.clothing, changeset.note).execute(pool).await?; Ok(()) } @@ -44,7 +44,7 @@ impl Event { event.name, event.locationId, event.voluntaryWachhabender, - event.voluntaryFuehrungsassistent, + event.fuehrungsassistentRequired, event.amountOfPosten, event.clothing, event.canceled, @@ -81,7 +81,7 @@ impl Event { area: None, }), voluntary_wachhabender: record.voluntarywachhabender, - voluntary_fuehrungsassistent: record.voluntaryfuehrungsassistent, + fuehrungsassistent_required: record.fuehrungsassistentrequired, amount_of_posten: record.amountofposten, clothing: Clothing { id: record.clothingid, @@ -109,7 +109,7 @@ impl Event { event.name, event.locationId, event.voluntaryWachhabender, - event.voluntaryFuehrungsassistent, + event.fuehrungsassistentRequired, event.amountOfPosten, event.clothing, event.canceled, @@ -149,7 +149,7 @@ impl Event { area: None, }), voluntary_wachhabender: record.voluntarywachhabender, - voluntary_fuehrungsassistent: record.voluntaryfuehrungsassistent, + fuehrungsassistent_required: record.fuehrungsassistentrequired, amount_of_posten: record.amountofposten, clothing: Clothing { id: record.clothingid, @@ -173,7 +173,7 @@ impl Event { event.name, event.locationId, event.voluntaryWachhabender, - event.voluntaryFuehrungsassistent, + event.fuehrungsassistentRequired, event.amountOfPosten, event.clothing, event.canceled, @@ -206,7 +206,7 @@ impl Event { area: None, }), voluntary_wachhabender: record.voluntarywachhabender, - voluntary_fuehrungsassistent: record.voluntaryfuehrungsassistent, + fuehrungsassistent_required: record.fuehrungsassistentrequired, amount_of_posten: record.amountofposten, clothing: Clothing { id: record.clothingid, @@ -221,14 +221,14 @@ impl Event { pub async fn update(pool: &PgPool, id: i32, changeset: EventChangeset) -> Result<()> { query!(r#" - UPDATE event SET startTimestamp = $1, endTimestamp = $2, name = $3, locationId = $4, voluntaryWachhabender = $5, voluntaryFuehrungsassistent = $6, amountOfPosten = $7, clothing = $8, note = $9 WHERE id = $10; + UPDATE event SET startTimestamp = $1, endTimestamp = $2, name = $3, locationId = $4, voluntaryWachhabender = $5, fuehrungsassistentRequired = $6, amountOfPosten = $7, clothing = $8, note = $9 WHERE id = $10; "#, changeset.time.0.and_utc(), changeset.time.1.and_utc(), changeset.name, changeset.location_id, changeset.voluntary_wachhabender, - changeset.voluntary_fuehrungsassistent, + changeset.fuehrungsassistent_required, changeset.amount_of_posten, changeset.clothing, changeset.note, id) diff --git a/db/src/models/event_changeset.rs b/db/src/models/event_changeset.rs index 8ba47b24..519a066e 100644 --- a/db/src/models/event_changeset.rs +++ b/db/src/models/event_changeset.rs @@ -23,7 +23,7 @@ pub struct EventChangeset { pub name: String, pub location_id: i32, pub voluntary_wachhabender: bool, - pub voluntary_fuehrungsassistent: bool, + pub fuehrungsassistent_required: bool, pub amount_of_posten: i16, pub clothing: i32, pub note: Option, @@ -69,7 +69,7 @@ impl<'a> AsyncValidate<'a> for EventChangeset { date_unchanged_if_edit(&self.time, &event.start.date())?; can_unset_wachhabender(&self.voluntary_wachhabender, &assignments_for_event)?; can_unset_fuehrungsassistent( - &self.voluntary_fuehrungsassistent, + &self.fuehrungsassistent_required, &assignments_for_event, )?; if location.area_id != event.location.unwrap().area_id { @@ -237,7 +237,7 @@ impl EventChangeset { name: Faker.fake(), location_id: 1, voluntary_wachhabender: true, - voluntary_fuehrungsassistent: true, + fuehrungsassistent_required: true, amount_of_posten: 5, clothing: 1, note: None, diff --git a/db/src/models/export_event_row.rs b/db/src/models/export_event_row.rs index a5404d8c..6a5d581f 100644 --- a/db/src/models/export_event_row.rs +++ b/db/src/models/export_event_row.rs @@ -11,7 +11,7 @@ pub struct ExportEventRow { pub start_timestamp: NaiveDateTime, pub end_timestamp: NaiveDateTime, pub amount_of_posten: i16, - pub voluntary_fuehrungsassistent: bool, + pub fuehrungsassistent_required: bool, pub voluntary_wachhabender: bool, pub location_name: String, pub event_name: String, @@ -53,7 +53,7 @@ impl ExportEventRow { start_timestamp: r.starttimestamp.naive_utc(), end_timestamp: r.endtimestamp.naive_utc(), amount_of_posten: r.amountofposten, - voluntary_fuehrungsassistent: r.voluntaryfuehrungsassistent, + fuehrungsassistent_required: r.fuehrungsassistentrequired, voluntary_wachhabender: r.voluntarywachhabender, location_name: r.locationname, event_name: r.eventname, diff --git a/web/snapshots/brass_web__endpoints__events__get_edit__tests__inner_produces_template.snap b/web/snapshots/brass_web__endpoints__events__get_edit__tests__inner_produces_template.snap index 275086ae..504d246a 100644 --- a/web/snapshots/brass_web__endpoints__events__get_edit__tests__inner_produces_template.snap +++ b/web/snapshots/brass_web__endpoints__events__get_edit__tests__inner_produces_template.snap @@ -12,7 +12,7 @@ snapshot_kind: text - @@ -133,7 +133,7 @@ snapshot_kind: text diff --git a/web/src/endpoints/events/get_edit.rs b/web/src/endpoints/events/get_edit.rs index be0591cb..c7d45a34 100644 --- a/web/src/endpoints/events/get_edit.rs +++ b/web/src/endpoints/events/get_edit.rs @@ -51,7 +51,7 @@ pub async fn get( name: Some(event.name), location: Some(event.location_id), voluntary_wachhabender: event.voluntary_wachhabender, - voluntary_fuehrungsassistent: event.voluntary_fuehrungsassistent, + fuehrungsassistent_required: event.fuehrungsassistent_required, amount_of_posten: Some(event.amount_of_posten), clothing: Some(event.clothing.id), clothing_options, @@ -86,7 +86,7 @@ mod tests { ), name: "Vorstellung".to_string(), location_id: 1, - voluntary_fuehrungsassistent: false, + fuehrungsassistent_required: false, voluntary_wachhabender: false, amount_of_posten: 2, clothing: 1, diff --git a/web/src/endpoints/events/get_new.rs b/web/src/endpoints/events/get_new.rs index 38c2ca3a..362d7ca3 100644 --- a/web/src/endpoints/events/get_new.rs +++ b/web/src/endpoints/events/get_new.rs @@ -41,7 +41,7 @@ pub async fn get( name: None, location: None, voluntary_wachhabender: false, - voluntary_fuehrungsassistent: false, + fuehrungsassistent_required: false, amount_of_posten: None, clothing: None, clothing_options, diff --git a/web/src/endpoints/events/mod.rs b/web/src/endpoints/events/mod.rs index 4f66eb64..042816d5 100644 --- a/web/src/endpoints/events/mod.rs +++ b/web/src/endpoints/events/mod.rs @@ -30,7 +30,7 @@ pub struct NewOrEditEventTemplate { name: Option, location: Option, voluntary_wachhabender: bool, - voluntary_fuehrungsassistent: bool, + fuehrungsassistent_required: bool, amount_of_posten: Option, clothing: Option, clothing_options: Vec, @@ -50,7 +50,7 @@ pub struct NewOrEditEventForm { end: NaiveDateTime, location: i32, voluntarywachhabender: bool, - voluntaryfuehrungsassistent: bool, + fuehrungsassistentrequired: bool, amount: i16, clothing: i32, note: Option, diff --git a/web/src/endpoints/events/post_edit.rs b/web/src/endpoints/events/post_edit.rs index e2fe04d4..bd6bb683 100644 --- a/web/src/endpoints/events/post_edit.rs +++ b/web/src/endpoints/events/post_edit.rs @@ -36,7 +36,7 @@ pub async fn post( .clone() .and_then(|n| if !n.is_empty() { Some(n) } else { None }), voluntary_wachhabender: form.voluntarywachhabender, - voluntary_fuehrungsassistent: form.voluntaryfuehrungsassistent, + fuehrungsassistent_required: form.fuehrungsassistentrequired, }; let context = EventContext { diff --git a/web/src/endpoints/events/post_new.rs b/web/src/endpoints/events/post_new.rs index e7554706..7dc81ef1 100644 --- a/web/src/endpoints/events/post_new.rs +++ b/web/src/endpoints/events/post_new.rs @@ -31,7 +31,7 @@ pub async fn post( .clone() .and_then(|n| if !n.is_empty() { Some(n) } else { None }), voluntary_wachhabender: form.voluntarywachhabender, - voluntary_fuehrungsassistent: form.voluntaryfuehrungsassistent, + fuehrungsassistent_required: form.fuehrungsassistentrequired, }; let event_context = EventContext { diff --git a/web/src/endpoints/export/get_events_data.rs b/web/src/endpoints/export/get_events_data.rs index eb47be33..e0890ae0 100644 --- a/web/src/endpoints/export/get_events_data.rs +++ b/web/src/endpoints/export/get_events_data.rs @@ -87,7 +87,7 @@ fn read(rows: Vec) -> Vec { Some(&assigned_fuass.name), Some(&assigned_fuass.function.short_display()), )); - } else if r.voluntary_fuehrungsassistent { + } else if r.fuehrungsassistent_required { entries.push(create_new_entry( None, Some(&Function::Fuehrungsassistent.short_display()), diff --git a/web/src/utils/event_planning_template.rs b/web/src/utils/event_planning_template.rs index 833015a4..749d7f0d 100644 --- a/web/src/utils/event_planning_template.rs +++ b/web/src/utils/event_planning_template.rs @@ -76,7 +76,7 @@ pub async fn generate_status_whether_staff_is_required( .count() < event.amount_of_posten as usize; - let further_fuehrungsassistent_required = event.voluntary_fuehrungsassistent + let further_fuehrungsassistent_required = event.fuehrungsassistent_required && existing_assignments_for_event .iter() .all(|a| a.function != Function::Fuehrungsassistent); diff --git a/web/src/utils/mod.rs b/web/src/utils/mod.rs index a6ef56ca..79cf6d9f 100644 --- a/web/src/utils/mod.rs +++ b/web/src/utils/mod.rs @@ -22,7 +22,7 @@ use chrono::{NaiveDate, Utc}; pub fn get_return_url_for_date(date: &NaiveDate) -> String { let today = Utc::now().date_naive(); if date == &today { - return String::from("/"); + return String::from("/calendar"); } format!("/calendar?date={}", date) diff --git a/web/templates/calendar.html b/web/templates/calendar.html index b6313f1d..b1eb59d4 100644 --- a/web/templates/calendar.html +++ b/web/templates/calendar.html @@ -167,7 +167,7 @@
-

Führungsassistent benötigt: {% if event.voluntary_fuehrungsassistent %}ja{% else %}nein{% endif +

Führungsassistent benötigt: {% if event.fuehrungsassistent_required %}ja{% else %}nein{% endif %}

diff --git a/web/templates/events/new_or_edit.html b/web/templates/events/new_or_edit.html index 3b9a65e7..04d154fe 100644 --- a/web/templates/events/new_or_edit.html +++ b/web/templates/events/new_or_edit.html @@ -12,8 +12,8 @@ - + {% if let Some(id) = id %}
@@ -141,8 +141,8 @@
{% if fa_disabled %} diff --git a/web/templates/events/plan.html b/web/templates/events/plan.html index 148304ce..fa34ba56 100644 --- a/web/templates/events/plan.html +++ b/web/templates/events/plan.html @@ -32,7 +32,7 @@
-

Führungsassistent benötigt: {% if event.voluntary_fuehrungsassistent %}ja{% else %}nein{% endif %} +

Führungsassistent benötigt: {% if event.fuehrungsassistent_required %}ja{% else %}nein{% endif %}