Skip to content

Commit

Permalink
Add atm counter
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 23, 2023
1 parent 1e2b2c8 commit 04f8d82
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/command/generate_reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ pub async fn run(mut db: Connection) -> Result<()> {
fn generate_report_tags(elements: &[&OverpassElementJson]) -> Result<Value> {
info!("Generating report tags");

let atms: Vec<_> = elements
.iter()
.filter(|it| it.get_tag_value("amenity") == "atm")
.collect();

let onchain_elements: Vec<_> = elements
.iter()
.filter(|it| it.get_tag_value("payment:onchain") == "yes")
Expand Down Expand Up @@ -168,6 +173,7 @@ fn generate_report_tags(elements: &[&OverpassElementJson]) -> Result<Value> {

let mut tags: HashMap<String, Value> = HashMap::new();
tags.insert("total_elements".into(), elements.len().into());
tags.insert("total_atms".into(), atms.len().into());
tags.insert(
"total_elements_onchain".into(),
onchain_elements.len().into(),
Expand Down

0 comments on commit 04f8d82

Please sign in to comment.