Skip to content

Commit

Permalink
sort list of agencies and chateaus
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Nov 14, 2024
1 parent 4477ed8 commit 08166eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/birch/get_agencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ use catenary::models::IpToGeoAddr;
use catenary::postgis_to_diesel::diesel_multi_polygon_to_geo;
use catenary::postgres_tools::{make_async_pool, CatenaryPostgresPool};
use catenary::EtcdConnectionIps;
use diesel::query_dsl::methods::FilterDsl;
use diesel::query_dsl::select_dsl::SelectDsl;
use diesel::ExpressionMethods;
use diesel::SelectableHelper;
use diesel_async::RunQueryDsl;
use diesel::prelude::*;
use geojson::{Feature, GeoJson, JsonValue};
use ordered_float::Pow;
use serde::Deserialize;
Expand Down Expand Up @@ -38,6 +37,7 @@ pub async fn get_agencies_raw(
let agencies_pg: Result<Vec<catenary::models::Agency>, _> =
catenary::schema::gtfs::agencies::dsl::agencies
.select(catenary::models::Agency::as_select())
.order(catenary::schema::gtfs::agencies::dsl::agency_name)
.load(conn)
.await;

Expand Down
4 changes: 3 additions & 1 deletion src/birch/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ async fn chateaus(
.unwrap();

// convert hulls to standardised `geo` crate
let formatted_chateaus = existing_chateaus
let mut formatted_chateaus = existing_chateaus
.into_iter()
.filter(|pg_chateau| pg_chateau.hull.is_some())
.map(|pg_chateau| ChateauToSend {
Expand All @@ -319,6 +319,8 @@ async fn chateaus(
})
.collect::<Vec<ChateauToSend>>();

formatted_chateaus.sort_by_key(|x| x.chateau.clone());

// conversion to `geojson` structs
let features = formatted_chateaus
.iter()
Expand Down

0 comments on commit 08166eb

Please sign in to comment.