From fc03cde23ec18a5345f4d3fced62fbe2da43d0bf Mon Sep 17 00:00:00 2001 From: Warittorn Cheevachaipimol Date: Fri, 16 Feb 2024 14:28:19 +0700 Subject: [PATCH] cleanup --- bothan-coin-gecko/src/service.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bothan-coin-gecko/src/service.rs b/bothan-coin-gecko/src/service.rs index 9018929d..9f706cd8 100644 --- a/bothan-coin-gecko/src/service.rs +++ b/bothan-coin-gecko/src/service.rs @@ -137,11 +137,12 @@ async fn process_market_data(market: &Market, cache: &Arc>) { } fn parse_market(market: &Market) -> Result { - let naive_date_time = - NaiveDateTime::parse_from_str(market.last_updated.as_str(), "%Y-%m-%dT%H:%M:%S.%fZ") - .map_err(|_| Error::InvalidTimestamp)?; + let last_updated = market.last_updated.as_str(); + let naive_date_time = NaiveDateTime::parse_from_str(last_updated, "%Y-%m-%dT%H:%M:%S.%fZ") + .map_err(|_| Error::InvalidTimestamp)?; let timestamp = u64::try_from(naive_date_time.timestamp()).map_err(|_| Error::InvalidTimestamp)?; + Ok(PriceData::new( market.id.clone(), market.current_price.to_string(),