From fc1706d81187dd79c08b110c2f48b3223658b13e Mon Sep 17 00:00:00 2001 From: sevenzing <41516657+sevenzing@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:59:14 +0200 Subject: [PATCH] fix: indexing status can return null values (#1013) --- libs/blockscout-client/crate/Cargo.toml | 2 +- .../crate/src/models/indexing_status.rs | 22 +++---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/libs/blockscout-client/crate/Cargo.toml b/libs/blockscout-client/crate/Cargo.toml index f216f7824..af4c525a7 100644 --- a/libs/blockscout-client/crate/Cargo.toml +++ b/libs/blockscout-client/crate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blockscout-client" -version = "0.1.0" +version = "0.1.1" authors = ["l.lymarenko@blockscout.com"] description = "API for BlockScout web app" license = "Apache 2.0" diff --git a/libs/blockscout-client/crate/src/models/indexing_status.rs b/libs/blockscout-client/crate/src/models/indexing_status.rs index 7e8c2ae86..5507dd04a 100644 --- a/libs/blockscout-client/crate/src/models/indexing_status.rs +++ b/libs/blockscout-client/crate/src/models/indexing_status.rs @@ -11,30 +11,14 @@ use crate::models; use serde::{Deserialize, Serialize}; -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[derive(derive_new::new, Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct IndexingStatus { #[serde(rename = "finished_indexing")] pub finished_indexing: bool, #[serde(rename = "finished_indexing_blocks")] pub finished_indexing_blocks: bool, #[serde(rename = "indexed_blocks_ratio")] - pub indexed_blocks_ratio: String, + pub indexed_blocks_ratio: Option, // changed #[serde(rename = "indexed_internal_transactions_ratio")] - pub indexed_internal_transactions_ratio: String, -} - -impl IndexingStatus { - pub fn new( - finished_indexing: bool, - finished_indexing_blocks: bool, - indexed_blocks_ratio: String, - indexed_internal_transactions_ratio: String, - ) -> IndexingStatus { - IndexingStatus { - finished_indexing, - finished_indexing_blocks, - indexed_blocks_ratio, - indexed_internal_transactions_ratio, - } - } + pub indexed_internal_transactions_ratio: Option, // changed }