Skip to content

Commit

Permalink
Adding new current ride stats from boosted ride stats
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinrouillard committed Oct 20, 2024
1 parent 7afd733 commit 6af3ae8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/helpers/boosted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub async fn send_boosted_event(

let state = BoostedRideUpdate {
riding: in_ride,
current_ride: json.current_ride,
latest_ride: json.latest_ride,
stats: json.stats,
};
Expand Down
8 changes: 8 additions & 0 deletions src/services/boosted/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct BoostedStats {
pub current_ride: CurrentRideStats,
pub latest_ride: RideStats,
pub stats: Stats,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct CurrentRideStats {
pub started_at: String,
pub duration: f64,
pub distance: f64,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RideStats {
pub started_at: String,
Expand Down
5 changes: 4 additions & 1 deletion src/structs/boosted.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

use crate::services::boosted::structs::{RideStats, Stats};
use crate::services::boosted::structs::{
CurrentRideStats, RideStats, Stats,
};

#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize)]
pub struct BoostedRideUpdate {
pub riding: bool,
pub current_ride: CurrentRideStats,
pub latest_ride: RideStats,
pub stats: Stats,
}

0 comments on commit 6af3ae8

Please sign in to comment.