phase 5 qa and review pass
This commit is contained in:
+17
-17
@@ -15,7 +15,7 @@ const DIM_MEASURE: &str = "measure";
|
||||
const SENTINEL_VALUE: f64 = -1.0;
|
||||
|
||||
fn is_sentinel(v: f64) -> bool {
|
||||
v.total_cmp(&SENTINEL_VALUE) == std::cmp::Ordering::Equal
|
||||
v == SENTINEL_VALUE
|
||||
}
|
||||
|
||||
pub async fn fetch_metadata(client: &Client, url: &str) -> Result<(LookupMap, MetadataResponse)> {
|
||||
@@ -322,17 +322,17 @@ pub fn parse_row(row_index: usize, dataset: &Dataset, lookup_maps: &LookupMap) -
|
||||
})
|
||||
}
|
||||
|
||||
pub fn data_row_to_landing(row: &DataRow) -> Landing {
|
||||
pub fn data_row_to_landing(row: DataRow) -> Landing {
|
||||
Landing {
|
||||
month: row.month.clone(),
|
||||
species_code: row.species_code.clone(),
|
||||
species_label: row.species_label.clone(),
|
||||
gear_code: row.gear_code.clone(),
|
||||
zone_code: row.zone_code.clone(),
|
||||
processing_code: row.processing_code.clone(),
|
||||
preservation_code: row.preservation_code.clone(),
|
||||
shipsize_code: row.shipsize_code.clone(),
|
||||
measure_code: row.measure_code.clone(),
|
||||
month: row.month,
|
||||
species_code: row.species_code,
|
||||
species_label: row.species_label,
|
||||
gear_code: row.gear_code,
|
||||
zone_code: row.zone_code,
|
||||
processing_code: row.processing_code,
|
||||
preservation_code: row.preservation_code,
|
||||
shipsize_code: row.shipsize_code,
|
||||
measure_code: row.measure_code,
|
||||
value: row.value,
|
||||
}
|
||||
}
|
||||
@@ -608,13 +608,13 @@ mod tests {
|
||||
let lookup_maps = mock_lookup_maps();
|
||||
|
||||
let row = parse_row(0, &dataset.dataset, &lookup_maps).expect("parse failed");
|
||||
let landing = data_row_to_landing(&row);
|
||||
let landing = data_row_to_landing(row);
|
||||
|
||||
assert_eq!(landing.month, row.month);
|
||||
assert_eq!(landing.species_code, row.species_code);
|
||||
assert_eq!(landing.species_label, row.species_label);
|
||||
assert_eq!(landing.measure_code, row.measure_code);
|
||||
assert_eq!(landing.value, row.value);
|
||||
assert_eq!(landing.month, "2015M01");
|
||||
assert_eq!(landing.species_code, "148XXXXXXX00000");
|
||||
assert_eq!(landing.species_label, "Sild");
|
||||
assert_eq!(landing.measure_code, "MASS");
|
||||
assert_eq!(landing.value, Some(1234.5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user