Skip to content

Commit

Permalink
Fix wrong csv row selector format #529 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Oct 7, 2024
1 parent ea83f6b commit b0619b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Client/Pages/DataAnnotator/DataAnnotator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ type DataAnnotator =
prop.onClick(fun e ->
match model.DataAnnotatorModel.DataFile with
| Some dtf ->
let selectors = [|for x in state do x.ToFragmentSelectorString()|]
let selectors = [|for x in state do x.ToFragmentSelectorString(model.DataAnnotatorModel.ParsedFile.Value.HeaderRow.IsSome)|]
let name = dtf.DataFileName
let dt = dtf.DataFileType
SpreadsheetInterface.AddDataAnnotation {|fileName=name; fileType=dt; fragmentSelectors=selectors; targetColumn=targetCol|}
Expand Down
5 changes: 3 additions & 2 deletions src/Client/States/DataAnnotator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ type DataTarget =
| Row of int
| Column of int

member this.ToFragmentSelectorString() =
member this.ToFragmentSelectorString(hasHeader: bool) =
let rowOffset = if hasHeader then 2 else 1 // header counts and is 1-based
match this with
| Row ri -> sprintf "row=%i" ri
| Row ri -> sprintf "row=%i" (ri + rowOffset)
| Column ci -> sprintf "col=%i" ci
| Cell (ci, ri) -> sprintf "cell=%i,%i" ri ci

Expand Down

0 comments on commit b0619b3

Please sign in to comment.