-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding multiple building blocks of the same type (#243).
- Loading branch information
1 parent
e7af6aa
commit e9e9c80
Showing
4 changed files
with
59 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module OfficeInterop.Indexing | ||
|
||
open Shared.OfficeInteropTypes | ||
|
||
|
||
/// This is based on a excel hack on how to add multiple header of the same name to an excel table., | ||
/// by just appending more whitespace to the name. | ||
let extendName (existingNames: string []) (baseName:string) = | ||
let rec loop (baseName:string) = | ||
if existingNames |> Array.contains baseName then | ||
loop (baseName + " ") | ||
else | ||
baseName | ||
loop baseName | ||
|
||
let createTSR (newBB:InsertBuildingBlock) = | ||
let termAccession = if newBB.ColumnTerm.IsSome then newBB.ColumnTerm.Value.TermAccession else "" | ||
$"{ColumnCoreNames.TermSourceRef.toString} ({termAccession})" | ||
|
||
let createTAN (newBB:InsertBuildingBlock) = | ||
let termAccession = if newBB.ColumnTerm.IsSome then newBB.ColumnTerm.Value.TermAccession else "" | ||
$"{ColumnCoreNames.TermAccessionNumber.toString} ({termAccession})" | ||
|
||
let createUnit() = | ||
$"{ColumnCoreNames.Unit.toString}" | ||
|
||
let createColumnNames (newBB:InsertBuildingBlock) (existingNames: string []) = | ||
let mainColumn = newBB.ColumnHeader.toAnnotationTableHeader() | ||
[| | ||
mainColumn | ||
if newBB.UnitTerm.IsSome then | ||
createUnit() | ||
if not newBB.ColumnHeader.Type.isSingleColumn then | ||
createTSR newBB | ||
createTAN newBB | ||
|] | ||
|> Array.map (extendName existingNames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters