Logo GenPRES

CalculationWeightsAndHeights Module

Parses the rows of the calculation weight sheet and the calculation height sheet into ascending whole grams and whole cm. Returns every error in the rows.

Functions and values

Function or value Description

CalculationWeightsAndHeights.ascending sheet values

Full Usage: CalculationWeightsAndHeights.ascending sheet values

Parameters:
    sheet : string
    values : (int * int<'u>) list

Returns: int<'u> array * NormalValueSheetWarning list
Type parameters: 'u

Returns the values in ascending order without duplicates, with a warning for each row that holds a value lower than a row above it or a value a row above it already holds.

sheet : string
values : (int * int<'u>) list
Returns: int<'u> array * NormalValueSheetWarning list

CalculationWeightsAndHeights.heightColumn

Full Usage: CalculationWeightsAndHeights.heightColumn

Returns: string

The column of the calculation heights, in cm.

Returns: string

CalculationWeightsAndHeights.heightSheet

Full Usage: CalculationWeightsAndHeights.heightSheet

Returns: string

The sheet of the calculation heights.

Returns: string

CalculationWeightsAndHeights.ofRows rows

Full Usage: CalculationWeightsAndHeights.ofRows rows

Parameters:
    rows : Map<string, string[][]>

Returns: Validation<(CalculationWeightsAndHeights * NormalValueSheetWarning list), NormalValueSheetError>

Builds the calculation weights and heights from the rows of the two sheets, keyed by sheet name. The weights in kg become whole grams, the heights whole cm. Returns every error of both sheets, with MissingSheet for a sheet that is not in the map; otherwise the weights and heights with the warnings of both sheets.

rows : Map<string, string[][]>
Returns: Validation<(CalculationWeightsAndHeights * NormalValueSheetWarning list), NormalValueSheetError>

CalculationWeightsAndHeights.parseSheet sheet column toWhole rows

Full Usage: CalculationWeightsAndHeights.parseSheet sheet column toWhole rows

Parameters:
    sheet : string
    column : string
    toWhole : float -> int<'u>
    rows : string[] array

Returns: Validation<(int * int<'u>) list, NormalValueSheetError>
Type parameters: 'u

Parses the rows of a sheet, header first, into the numbers of a column with their row numbers, each rounded to a whole value by toWhole. A blank cell is skipped. Returns every error in the rows: a number that is not positive, a number that rounds to 0, and NoValues when no row holds a value.

sheet : string
column : string
toWhole : float -> int<'u>
rows : string[] array
Returns: Validation<(int * int<'u>) list, NormalValueSheetError>

CalculationWeightsAndHeights.sheets

Full Usage: CalculationWeightsAndHeights.sheets

Returns: string list

The names of the two sheets.

Returns: string list

CalculationWeightsAndHeights.weightColumn

Full Usage: CalculationWeightsAndHeights.weightColumn

Returns: string

The column of the calculation weights, in kg.

Returns: string

CalculationWeightsAndHeights.weightSheet

Full Usage: CalculationWeightsAndHeights.weightSheet

Returns: string

The sheet of the calculation weights.

Returns: string

Type something to start searching.