Skip to content

Commit

Permalink
Check for empty fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepdeJong committed Oct 2, 2023
1 parent 823b232 commit 0350f0c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,20 @@ pub async fn passes_handler(Query(data): Query<PassModel>) -> Result<impl IntoRe
field.label("Time");
event_ticket.add_secondary_field(field);

if let Some(location) = data.location {
let mut field = Field::new_string("loc", location.as_str());
field.label("Location");
event_ticket.add_auxiliary_field(field);
if let Some(name) = data.name {
if !name.is_empty() {
let mut field = Field::new_string("name", name.as_str());
field.label("Name");
event_ticket.add_auxiliary_field(field);
}
}

if let Some(name) = data.name {
let mut field = Field::new_string("name", name.as_str());
field.label("Name");
event_ticket.add_auxiliary_field(field);
if let Some(location) = data.location {
if !location.is_empty() {
let mut field = Field::new_string("loc", location.as_str());
field.label("Location");
event_ticket.add_auxiliary_field(field);
}
}

pass.event_ticket(event_ticket);
Expand Down

0 comments on commit 0350f0c

Please sign in to comment.