fix: ODP membership status#832
Conversation
WalkthroughThe pull request introduces changes to the overview middleware, schema, and view components to add a new Changes
Sequence DiagramsequenceDiagram
participant Middleware
participant Schema
participant View
Middleware->>Middleware: Calculate isOPDMember
Middleware->>Schema: Add isOPDMember property
Middleware->>View: Pass isOPDMember flag
View->>View: Render membership status
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/middleware/overview.middleware.js (1)
250-250: Consider using Array.some() for better performance.The
isOPDMembercheck could be optimised by usingArray.some()instead offindIndex >= 0.-const isOPDMember = provisions.findIndex((p) => p.project === 'open-digital-planning') >= 0 +const isOPDMember = provisions.some((p) => p.project === 'open-digital-planning')
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/middleware/overview.middleware.js(3 hunks)src/routes/schemas.js(1 hunks)src/views/organisations/overview.html(1 hunks)test/unit/middleware/overview.middleware.test.js(3 hunks)
🔇 Additional comments (8)
src/routes/schemas.js (1)
133-134: LGTM! Schema update correctly defines ODP membership.The addition of the mandatory
isOPDMemberboolean property to theOrgOverviewPageschema is appropriate for tracking an organisation's ODP membership status.src/middleware/overview.middleware.js (2)
230-233: LGTM! Map initialization is correctly positioned.The
provisionDatamap initialization and population is appropriately placed after the destructuring of request properties.
275-276: LGTM! Template params correctly include membership status.The
isOPDMemberflag is properly included in the template parameters.test/unit/middleware/overview.middleware.test.js (4)
67-76: LGTM! Function signature and documentation improved.The
getRenderedErrorCardsfunction now correctly returns both error cards and document, with proper JSDoc documentation.
101-102: LGTM! Test params updated with membership status.The expected template parameters now include the
isOPDMemberflag.
111-121: LGTM! Comprehensive test coverage for membership status.The test cases thoroughly verify the rendering of membership information for both ODP members and non-members.
163-164: LGTM! Overview test includes membership status.The
getOverviewtest correctly includes theisOPDMemberflag in the template parameters.src/views/organisations/overview.html (1)
Line range hint
142-146: LGTM! Membership status display logic simplified.The template now uses the dedicated
isOPDMemberflag instead of checking dataset properties, making the logic clearer and more maintainable.
What type of PR is this? (check all applicable)
Description
The ODP membership status text on LPA overview pages is incorrect. Code that added project info to the datasets was erroneously removed in #730. Adding it back (with slight change).
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Going to the LPA overview pages, they should now correctly indicate whether the organisation is part of the programme or not.
Added/updated tests?
QA sign off
Summary by CodeRabbit
Release Notes
New Features
isOPDMemberflag to indicate Open Digital Planning programme membershipImprovements
Testing
These changes improve the visibility and handling of Open Digital Planning programme membership information across the application.