Small changes
This commit is contained in:
parent
a7d528fb68
commit
f9bd218a3e
9 changed files with 212 additions and 16 deletions
|
|
@ -8,6 +8,14 @@ use crate::data::{Histogram, PropertyData};
|
|||
use crate::features::{ENUM_FEATURE_GROUPS, FEATURE_GROUPS};
|
||||
use crate::state::AppState;
|
||||
|
||||
fn is_empty(v: &str) -> bool {
|
||||
v.is_empty()
|
||||
}
|
||||
|
||||
fn is_false(v: &bool) -> bool {
|
||||
!v
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum FeatureInfo {
|
||||
|
|
@ -21,6 +29,12 @@ pub enum FeatureInfo {
|
|||
description: &'static str,
|
||||
detail: &'static str,
|
||||
source: &'static str,
|
||||
#[serde(skip_serializing_if = "is_empty")]
|
||||
prefix: &'static str,
|
||||
#[serde(skip_serializing_if = "is_empty")]
|
||||
suffix: &'static str,
|
||||
#[serde(skip_serializing_if = "is_false")]
|
||||
raw: bool,
|
||||
},
|
||||
#[serde(rename = "enum")]
|
||||
Enum {
|
||||
|
|
@ -82,6 +96,9 @@ pub fn build_features_response(data: &PropertyData) -> FeaturesResponse {
|
|||
description: feature_config.description,
|
||||
detail: feature_config.detail,
|
||||
source: feature_config.source,
|
||||
prefix: feature_config.prefix,
|
||||
suffix: feature_config.suffix,
|
||||
raw: feature_config.raw,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ pub async fn get_hexagon_stats(
|
|||
|
||||
// Collect price history (year, price) pairs
|
||||
let price_history = {
|
||||
let year_idx = state.feature_name_to_index.get("Transaction year").copied();
|
||||
let year_idx = state.feature_name_to_index.get("Date of last transaction").copied();
|
||||
let price_idx = state.feature_name_to_index.get("Last known price").copied();
|
||||
match (year_idx, price_idx) {
|
||||
(Some(yi), Some(pi)) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue