Skip to content

Commit

Permalink
Merge pull request #1716 from quadratichq/fix-formulas-get-cells
Browse files Browse the repository at this point in the history
Rework get_cell_for_formula
  • Loading branch information
davidkircos authored Aug 15, 2024
2 parents 7211292 + 41623f8 commit 4b20aab
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions quadratic-core/src/grid/sheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,7 @@ impl Sheet {
/// Returns the cell value at a position using both `column.values` and
/// `code_runs`, for use when a formula references a cell.
pub fn get_cell_for_formula(&self, pos: Pos) -> CellValue {
match self
.get_column(pos.x)
.and_then(|column| column.values.get(&pos.y))
.unwrap_or(&CellValue::Blank)
{
CellValue::Blank | CellValue::Code(_) => match self.code_runs.get(&pos) {
Some(run) => run.get_cell_for_formula(0, 0),
None => CellValue::Blank,
},
other => other.clone(),
}
self.display_value(pos).unwrap_or(CellValue::Blank)
}

/// Returns a formatting property of a cell.
Expand Down

0 comments on commit 4b20aab

Please sign in to comment.