Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deduplication on occupancies #896

Merged
merged 3 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Hove <core@hove.com>", "Guillaume Pinot <texitoi@texitoi.eu>"]
name = "transit_model"
version = "0.55.0"
version = "0.56.0"
license = "AGPL-3.0-only"
description = "Transit data management"
repository = "https://github.com/hove-io/transit_model"
Expand Down
1 change: 1 addition & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ impl Collections {
self.grid_exception_dates = dedup_collection(&mut self.grid_exception_dates);
self.grid_periods = dedup_collection(&mut self.grid_periods);
self.grid_rel_calendar_line = dedup_collection(&mut self.grid_rel_calendar_line);
self.occupancies = dedup_collection(&mut self.occupancies);

Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ impl AddPrefix for Address {
}
}

#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default)]
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum OccupancyStatus {
Empty,
Expand All @@ -1915,7 +1915,7 @@ pub enum OccupancyStatus {
NotBoardable,
}

#[derive(Debug, Default, Serialize, Deserialize, Clone)]
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
pub struct Occupancy {
pub line_id: String,
pub from_stop_area: String,
Expand Down Expand Up @@ -1992,21 +1992,21 @@ mod tests {
green: 255,
blue: 255,
};
assert_eq!("FFFFFF", serde_json::to_value(&white).unwrap());
assert_eq!("FFFFFF", serde_json::to_value(white).unwrap());

let black = Rgb {
red: 0,
green: 0,
blue: 0,
};
assert_eq!("000000", serde_json::to_value(&black).unwrap());
assert_eq!("000000", serde_json::to_value(black).unwrap());

let blue = Rgb {
red: 0,
green: 125,
blue: 255,
};
assert_eq!("007DFF", serde_json::to_value(&blue).unwrap());
assert_eq!("007DFF", serde_json::to_value(blue).unwrap());
}

#[test]
Expand Down