diff --git a/examples/dk_jets.md b/examples/dk_jets.md index f460e96..1db713c 100644 --- a/examples/dk_jets.md +++ b/examples/dk_jets.md @@ -1,8 +1,9 @@ # Use of Danish private jets {from_date} to {to_date}, Danish private jets emitted -{emissions_tons.claim} tons of CO2e[^5], the equivalent of what **{dane_years.claim} Danes** -emit in a year[^4]. +{emissions_tons.claim} tons of CO2e[^1], the equivalent of what **{dane_years.claim} Danes** +emit in a year[^2]. All of this was done by only {number_of_private_jets.claim} private jets[^3] +in {number_of_legs.claim} trips[^4]. Of these, * {number_of_legs_less_300km} trips were less than 300 km and could have been replaced by @@ -17,8 +18,9 @@ Ban private jets now and until they emit what equivalent means of transportation ## References -[^2]: {number_of_legs.source} - retrieved on {number_of_legs.date} -[^4]: {dane_years.source} - retrieved on {dane_years.date} -[^5]: {emissions_tons.source} - retrieved on {emissions_tons.date} +[^1]: {emissions_tons.source} - retrieved on {emissions_tons.date} +[^2]: {dane_years.source} - retrieved on {dane_years.date} +[^3]: {number_of_private_jets.source} on {number_of_private_jets.date} +[^4]: {number_of_legs.source} - retrieved on {number_of_legs.date} Copyright Jorge Leitão, released under [CC0](https://creativecommons.org/public-domain/cc0/) - No Rights Reserved. diff --git a/examples/dk_jets.rs b/examples/dk_jets.rs index 52c07ee..b0ecb41 100644 --- a/examples/dk_jets.rs +++ b/examples/dk_jets.rs @@ -27,6 +27,7 @@ fn render(context: &Context) -> Result<(), Box> { pub struct Context { pub from_date: String, pub to_date: String, + pub number_of_private_jets: Fact, pub number_of_legs: Fact, pub emissions_tons: Fact, pub dane_years: Fact, @@ -78,7 +79,7 @@ async fn main() -> Result<(), Box> { let aircrafts = load_aircrafts(client.as_ref()).await?; let types = load_aircraft_types()?; - let dk_private_jets = aircrafts + let private_jets = aircrafts .into_iter() // is private jet .filter(|(_, a)| types.contains_key(&a.model)) @@ -86,6 +87,14 @@ async fn main() -> Result<(), Box> { .filter(|(a, _)| a.starts_with("OY-")) .collect::>(); + let number_of_private_jets = Fact { + claim: private_jets.len(), + source: format!( + "All aircrafts in [adsbexchange.com](https://globe.adsbexchange.com) whose model is a private jet and tail number starts with \"OY-\"" + ), + date: "2023-11-06".to_string(), + }; + let to = time::OffsetDateTime::now_utc().date() - time::Duration::days(1); let from = date!(2021 - 01 - 01); @@ -101,7 +110,7 @@ async fn main() -> Result<(), Box> { let iter = dates .map(|date| { let client = client.as_ref(); - dk_private_jets + private_jets .iter() .map(move |(_, a)| flights::positions(&a.icao_number, date.clone(), 1000.0, client)) }) @@ -184,6 +193,7 @@ async fn main() -> Result<(), Box> { let context = Context { from_date, to_date, + number_of_private_jets, number_of_legs, emissions_tons, dane_years,