mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: number sort (#2508)
This commit is contained in:
@ -243,7 +243,17 @@ impl TypeOptionCellDataCompare for NumberTypeOption {
|
||||
cell_data: &<Self as TypeOption>::CellData,
|
||||
other_cell_data: &<Self as TypeOption>::CellData,
|
||||
) -> Ordering {
|
||||
cell_data.0.cmp(&other_cell_data.0)
|
||||
let left = NumberCellFormat::from_format_str(&cell_data.0, self.sign_positive, &self.format);
|
||||
let right =
|
||||
NumberCellFormat::from_format_str(&other_cell_data.0, self.sign_positive, &self.format);
|
||||
match (left, right) {
|
||||
(Ok(left), Ok(right)) => {
|
||||
return left.decimal().cmp(&right.decimal());
|
||||
},
|
||||
(Ok(_), Err(_)) => Ordering::Greater,
|
||||
(Err(_), Ok(_)) => Ordering::Less,
|
||||
(Err(_), Err(_)) => Ordering::Equal,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::default::Default for NumberTypeOption {
|
||||
|
Reference in New Issue
Block a user