diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-07-23 17:01:41 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-07-23 17:01:41 -0400 |
commit | b75f4bfb546859ed3978bef94e51725e6721bfa6 (patch) | |
tree | b33cc0a8535848e85dc5d0a0b123d773f1bcf180 | |
parent | 59980b5d8e81b22ed22cd95fcb235ca98715e44b (diff) |
fix: Filter out unapproved quotes in migration
-rw-r--r-- | migration/src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/migration/src/main.rs b/migration/src/main.rs index 72252a9..ce2e8c7 100644 --- a/migration/src/main.rs +++ b/migration/src/main.rs @@ -33,6 +33,7 @@ struct Quote { key: Key, #[serde(default = "Vec::new")] votes: Vec<Vote>, + approved: bool, } #[derive(Serialize, Deserialize, Debug)] @@ -89,8 +90,11 @@ fn main() { .collect::<Vec<T>>() } let quotes: Vec<Quote> = parse_all("es); - let mut quotes: HashMap<String, Quote> = - quotes.into_iter().map(|q| (q.key.id.clone(), q)).collect(); + let mut quotes: HashMap<String, Quote> = quotes + .into_iter() + .filter(|q| q.approved) + .map(|q| (q.key.id.clone(), q)) + .collect(); let mut votes = "".to_string(); File::open(matches.value_of("votes_json").unwrap()) |