Skip to content

Commit

Permalink
add coord gps in result
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGANGLOFF committed Apr 11, 2024
1 parent 8014184 commit 2c411bf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions common/src/google/nearly_place_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ pub struct Emplacement {
rating: f64,
address: String,
picture: String,
lat: f64,
long: f64,
}

impl Emplacement {
fn new(name: String, rating: f64, address: String, picture: String) -> Self {
fn new(name: String, rating: f64, address: String, picture: String, lat: f64, long: f64) -> Self {
Self {
name,
rating,
address,
picture,
lat,
long
}
}
}
Expand All @@ -105,8 +109,9 @@ pub fn exploit_json(value: Value) -> Result<Vec<Emplacement>, anyhow::Error> {
};

let rating = place.rating.unwrap_or_else(|| 0.0);

let place = Emplacement::new(place.name, rating, place.vicinity, picture);
let lat = place.geometry.location.lat;
let long = place.geometry.location.lng;
let place = Emplacement::new(place.name, rating, place.vicinity, picture, lat, long);
place_list.push(place);
}
Ok(place_list)
Expand Down

0 comments on commit 2c411bf

Please sign in to comment.