From 66138b840cbc60e8090fe54681385c5603152549 Mon Sep 17 00:00:00 2001 From: will Date: Thu, 16 Oct 2025 12:48:47 -0400 Subject: [PATCH] fix: show all assessable sections ending in .1 except General/Scope intros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the filter excluded ALL sections where the number ended in .1, which incorrectly hid 272 legitimate assessable requirements from users. The old logic assumed all .1 sections were intro sections, but analysis shows: - 116 sections (30%) are titled "General" or "Scope" - these ARE intro sections - 272 sections (70%) have specific titles - these are REAL REQUIREMENTS Examples of sections that were incorrectly hidden: - 11B-404.2.1 "Revolving doors, gates and turnstiles" - 11B-206.2.1 "Site arrival points" - 11B-213.3.1.1 "Toilet compartments" - 11B-407.4.1 "Car dimensions" This fix uses title-based filtering instead of number-based filtering. Only sections ending in .1 that are titled "General" or "Scope" are excluded. All other sections ending in .1 with specific requirement titles are now visible. Impact: Users can now see and assess 272 additional code requirements. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/api/compliance/sections/route.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/api/compliance/sections/route.ts b/app/api/compliance/sections/route.ts index fb95377..001cc19 100644 --- a/app/api/compliance/sections/route.ts +++ b/app/api/compliance/sections/route.ts @@ -111,12 +111,22 @@ export async function GET(request: NextRequest) { throw sectionsError; } - // Exclude intro sections (sections ending in .1) from the main list + // Exclude intro sections (sections ending in .1 titled "General" or "Scope") // These are section group introductions that will be shown contextually - // Pattern matches: 11B-203.1, 11B-404.2.1, etc. + // We identify them by title rather than depth, as some .1 sections at any depth + // may be titled "General" (intro) while others have specific titles (real requirements) filteredSections = filteredSections.filter((section: any) => { - const parts = section.number.split(/[.-]/); - return parts[parts.length - 1] !== '1'; + // Only filter sections ending in .1 + if (!section.number.endsWith('.1')) { + return true; + } + + // Check if this is an intro section by title + const titleClean = (section.title || '').trim().replace(/\.$/, '').toLowerCase(); + const isIntroSection = titleClean === 'general' || titleClean === 'scope'; + + // Keep all non-intro sections, exclude intro sections + return !isIntroSection; }); // Format sections for frontend consumption