Skip to content

Commit e276081

Browse files
committed
fix: package comparison now includes revisions
1 parent 51496eb commit e276081

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/database/src/output/fix.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,16 @@ impl Fix {
6060
airport_ident: Option<String>,
6161
ref_table: Option<String>,
6262
) -> Self {
63-
let fix_type = if let Some(ref_table) = ref_table {
64-
Some(match ref_table.as_str() {
65-
"PA" => FixType::Airport,
66-
"PN" | "DB" => FixType::NdbNavaid,
67-
"PG" => FixType::RunwayThreshold,
68-
"PT" => FixType::GlsNavaid,
69-
"PI" => FixType::IlsNavaid,
70-
"D " => FixType::VhfNavaid,
71-
"EA" | "PC" => FixType::Waypoint,
72-
x => panic!("Unexpected table: '{x}'"),
73-
})
74-
} else {
75-
None
76-
};
63+
let fix_type = ref_table.map(|ref_table| match ref_table.as_str() {
64+
"PA" => FixType::Airport,
65+
"PN" | "DB" => FixType::NdbNavaid,
66+
"PG" => FixType::RunwayThreshold,
67+
"PT" => FixType::GlsNavaid,
68+
"PI" => FixType::IlsNavaid,
69+
"D " => FixType::VhfNavaid,
70+
"EA" | "PC" => FixType::Waypoint,
71+
x => panic!("Unexpected table: '{x}'"),
72+
});
7773

7874
Self {
7975
fix_type,

src/database/src/output/procedure/approach.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct Approach {
2020
///
2121
/// For approaches which are for a specific runway, it will have a format such as `I08L` or `R12-M`.
2222
/// - The first character identifies the type of approach, however this will not always match the `approach_type`
23-
/// field. The next three characters represent the runway identifier, such as `08L` or `12`.
23+
/// field. The next three characters represent the runway identifier, such as `08L` or `12`.
2424
/// - The 5th character (optional) is the multiple indicator of the approach, it can be any capital letter.
2525
/// - For approaches with a multiple indicator and no `LCR` on the runway, the 4th character will be a `-`
2626
///

src/wasm/src/dispatcher.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct Dispatcher<'a> {
5151
queue: Rc<RefCell<Vec<Rc<RefCell<Task>>>>>,
5252
}
5353

54-
impl<'a> Dispatcher<'a> {
54+
impl Dispatcher<'_> {
5555
pub fn new() -> Self {
5656
Dispatcher {
5757
commbus: CommBus::default(),
@@ -128,23 +128,27 @@ impl<'a> Dispatcher<'a> {
128128
let installed_cycle = match meta::get_installed_cycle_from_json(
129129
&Path::new(consts::NAVIGATION_DATA_WORK_LOCATION).join("cycle.json"),
130130
) {
131-
Ok(cycle) => Some(cycle.cycle),
131+
Ok(cycle) => Some(cycle),
132132
Err(_) => None,
133133
};
134134

135135
// Get the bundled cycle (if it exists)
136136
let bundled_cycle = match meta::get_installed_cycle_from_json(
137137
&Path::new(consts::NAVIGATION_DATA_DEFAULT_LOCATION).join("cycle.json"),
138138
) {
139-
Ok(cycle) => Some(cycle.cycle),
139+
Ok(cycle) => Some(cycle),
140140
Err(_) => None,
141141
};
142142

143143
// Determine if we are bundled ONLY and the bundled cycle is newer than the installed (old bundled) cycle
144144
let bundled_updated = if is_bundled.is_some_and(|x| x) {
145145
// Clippy yells but this isn't good to switch until if-let chaining is implemented (Rust 2024)
146-
if installed_cycle.is_some() && bundled_cycle.is_some() {
147-
bundled_cycle.unwrap() > installed_cycle.unwrap()
146+
if let (Some(installed_cycle), Some(bundled_cycle)) = (installed_cycle, bundled_cycle) {
147+
bundled_cycle
148+
.cycle
149+
.cmp(&installed_cycle.cycle)
150+
.then(bundled_cycle.revision.cmp(&installed_cycle.revision))
151+
.is_gt()
148152
} else {
149153
false
150154
}

0 commit comments

Comments
 (0)