From a3d73831520a425922164ac8457c36ed4f3ecc99 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Tue, 31 Mar 2026 15:29:34 -0400 Subject: [PATCH] Fix missing precincts with short ballot numbers in ballot range report The >= 4 digit guard was a Lansing-specific assumption that excluded ballot numbers shorter than 4 digits. Changed to require only 1+ digit and use the full numeric value so all precincts (e.g. FH 2-44) appear in the report. Co-Authored-By: Claude Sonnet 4.6 --- App/DomainModels/PurpleEnvelopeReportHelper.asp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/App/DomainModels/PurpleEnvelopeReportHelper.asp b/App/DomainModels/PurpleEnvelopeReportHelper.asp index 12766dd..6c08273 100644 --- a/App/DomainModels/PurpleEnvelopeReportHelper.asp +++ b/App/DomainModels/PurpleEnvelopeReportHelper.asp @@ -81,12 +81,11 @@ Class PurpleEnvelopeReportHelper_Class End Function Public Function BuildBallotRangesWithMissing(ByVal rs) - ' Groups raw PRECINCT/BALLOT_NUMBER rows by precinct, extracts last 4 digits of - ' the numeric portion (matching the PowerShell InkjetRecords analysis script), - ' computes min/max and any missing numbers in that range, then returns rows - ' sorted by precinct in descending order. + ' Groups raw PRECINCT/BALLOT_NUMBER rows by precinct, strips non-digits from each + ' ballot number, computes min/max and any missing numbers in that range, then + ' returns rows sorted by precinct in descending order. dim precinctNums : set precinctNums = CreateObject("Scripting.Dictionary") - dim precinct, rawNum, digits, i, ch, last4Str + dim precinct, rawNum, digits, i, ch Do Until rs.EOF precinct = Trim(rs("PRECINCT") & "") @@ -98,12 +97,11 @@ Class PurpleEnvelopeReportHelper_Class If ch >= "0" And ch <= "9" Then digits = digits & ch Next - If Len(digits) >= 4 Then - last4Str = Mid(digits, Len(digits) - 3, 4) + If Len(digits) > 0 Then If precinctNums.Exists(precinct) Then - precinctNums(precinct) = precinctNums(precinct) & "," & last4Str + precinctNums(precinct) = precinctNums(precinct) & "," & digits Else - precinctNums.Add precinct, last4Str + precinctNums.Add precinct, digits End If End If rs.MoveNext