fix: allow parsing of float values
This commit is contained in:
1 parent
97b8305068
commit
ffccaa6b04
1 file changed
+4
-2
@@ -17,14 +17,16 @@ impl Comparison for NumberComparison {
|
|||||||
// The prerequisites for all number comparisons is that the target value is Some(number) and the
|
// The prerequisites for all number comparisons is that the target value is Some(number) and the
|
||||||
// comparison member points to Some(number) in the student_info.
|
// comparison member points to Some(number) in the student_info.
|
||||||
let student_value = match comp_value {
|
let student_value = match comp_value {
|
||||||
ValueType::Number(Some(num)) => num.parse::<i32>().unwrap(),
|
ValueType::Number(Some(num)) => num.parse::<f32>().unwrap(),
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Student value is not a number".into());
|
return Err("Student value is not a number".into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
leptos::logging::log!("Parsing value: {:?}", target_value);
|
||||||
|
|
||||||
let target = match target_value {
|
let target = match target_value {
|
||||||
ValueType::Number(Some(num)) => num.parse::<i32>().unwrap(),
|
ValueType::Number(Some(num)) => num.parse::<f32>().unwrap(),
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Target value is not a number".into());
|
return Err("Target value is not a number".into());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user