Private/Get-TLFindingsScore.ps1

function Get-TLFindingsScore {
    <#
    .SYNOPSIS
        Extracts (v2) or recomputes (v1) the weighted score from a findings.json payload.
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [object]$Payload
    )

    if ($Payload.PSObject.Properties['summary'] -and $Payload.summary -and
        $Payload.summary.PSObject.Properties['score'] -and $null -ne $Payload.summary.score) {
        return [int]$Payload.summary.score
    }
    $findings = @($Payload.findings)
    $evaluated = @($findings | Where-Object { @('Pass', 'Fail') -contains [string]$_.Status }).Count
    if ($evaluated -eq 0) { return $null }
    return [int][Math]::Round(100.0 * (Get-TLScoreWeight -Findings $findings))
}