Filter inactive postcodes

This commit is contained in:
Alex Wright 2022-10-09 19:24:05 +01:00
parent 4c24f74d6e
commit 68bedf2c36
1 changed files with 1 additions and 0 deletions

View File

@ -144,6 +144,7 @@ fn build() {
.from_reader(io::stdin()); .from_reader(io::stdin());
let entries = csv_reader.deserialize() let entries = csv_reader.deserialize()
.filter_map(|r: Result<Postcode, csv::Error>| r.ok()) .filter_map(|r: Result<Postcode, csv::Error>| r.ok())
.filter(|full| match full.status { Status::Live => true, _ => false })
.map(|full: Postcode| SmolPostcode::from_postcode(full)) .map(|full: Postcode| SmolPostcode::from_postcode(full))
.map(|smol| Entry::new(smol.postcode.to_owned(), SerdeWrapper(smol))); .map(|smol| Entry::new(smol.postcode.to_owned(), SerdeWrapper(smol)));