Add remove_open_ticket function

This commit is contained in:
Bastian Gruber 2023-05-22 09:38:33 +02:00
parent 81686a07ad
commit 6ac3c46b37
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF

View file

@ -167,6 +167,9 @@ impl Db {
let mut state = self.state.lock().unwrap();
if let Some(tickets) = state.open_tickets.get_mut(&road) {
tickets.retain(|t| t.plate != ticket.plate);
if tickets.is_empty() {
state.open_tickets.remove(&road);
}
return true;
}
false