removing decimal with precision and decimal count
This commit is contained in:
@@ -93,9 +93,7 @@ pub fn normalize_exact(input: &str) -> String {
|
||||
/// names, so this deliberately matches the catalog vocabulary.
|
||||
pub fn canonical_exact_search_value(input: &str, field_type: &str) -> Result<String, String> {
|
||||
let normalized_type = field_type.trim().to_ascii_lowercase();
|
||||
if matches!(normalized_type.as_str(), "numeric" | "money")
|
||||
|| normalized_type.starts_with("decimal(")
|
||||
{
|
||||
if matches!(normalized_type.as_str(), "numeric" | "money") {
|
||||
return input
|
||||
.parse::<rust_decimal::Decimal>()
|
||||
.map(|value| value.normalize().to_string())
|
||||
@@ -288,10 +286,6 @@ mod tests {
|
||||
assert_eq!(canonical_exact_search_value("001", "link(adresar)").unwrap(), "1");
|
||||
assert_eq!(canonical_exact_search_value("10.50", "numeric").unwrap(), "10.5");
|
||||
assert_eq!(canonical_exact_search_value("10.50", "money").unwrap(), "10.5");
|
||||
assert_eq!(
|
||||
canonical_exact_search_value("10.50", "decimal(12, 2)").unwrap(),
|
||||
"10.5"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user