AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
73%
Quality Avg
?
74%
Security Avg
?
74%
Reviews
?
130
Review Result ?
solutionbowl/crm-dashbaord · 1f0426ed
This commit adds functionality related to managing 'fancy' market types for horses with additional UI controls and helper functions for managing runner selections and formatting runner numbers. The changes include multiple UI updates and CSS enhancements. The implementation is fairly clean with logical separations in helper functions, improving code readability and maintainability. However, some minor validation and error handling improvements could be considered for safety. Security risk is low assuming UI input is properly validated elsewhere. Business value is moderate given the feature-specific nature of changes. Bug risk is low but some edge cases in list operations and UI conditional rendering warrant attention.
Quality
?
85%
Security
?
80%
Business Value
?
70%
Maintainability
?
83%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Missing Validation
Where
src/modules/horse/pages/Market/AddMarket.tsx:46
Issue / Evidence
missing input validation in formatRunnerNumbers function
Suggested Fix
add validation to handle unexpected inputs like null or undefined
Early Return With Empty String In Buildrun...
Where
src/modules/horse/pages/Market/AddMarket.tsx:53
Issue / Evidence
early return with empty string in buildRunnerMarketName might lead to empty values propagating
Suggested Fix
consider adding logging or error handling on unexpected fancy types
Missing Validation
Where
src/modules/horse/pages/Market/AddMarket.tsx:457
Issue / Evidence
toast warning message usage for runner selection validation
Suggested Fix
add additional user guidance or prevent saving without runner selection to reduce user errors
Access To Nested Properties (N[I].Selected...
Where
src/modules/horse/pages/Market/AddMarket.tsx:380
Issue / Evidence
access to nested properties (n[i].selected_runner_ids) may cause runtime errors if n or i invalid
Suggested Fix
add defensive coding for bounds and null checks
Confusing Conditional Logic For Market Nam...
Where
src/modules/horse/pages/Market/AddMarket.tsx:386
Issue / Evidence
confusing conditional logic for market_name assignment could be simplified or well-documented to improve maintainability
Suggested Fix
Review and simplify this section.
Code Change Preview · src/modules/horse/pages/Market/AddMarket.tsx
?
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Market/AddMarket.tsx b/src/modules/horse/pages/Market/AddMarket.tsx - index 2458326..9d26f4b 100644 - - const MARKET_TYPES = ["WIN", "2PLACES", "3PLACES", "4PLACES", "FANCY"]; - const MARKET_ODDS_TYPES = ["IndianManual", "ToteMarket"]; - const FANCY_TYPES = ["DEFAULT", "OBJECTION", "ODDS & EVENS", "PHOTO"]; - const MARKET_TYPE_RUNNER_REQUIREMENTS: Record<string, number> = { - WIN: 1, - "2PLACES": 2, - const DEFAULT_MARKET_ODDS_TYPE = "IndianManual"; - const TOTAL_ROWS = 25; - - type MarketRow = { - market_type: string; - market_odds_type: string; - }, [availableMarketTypes, usedUniqueTypesPerRow, rows]); - - const hasFancy = rows.some(r => r.market_type === "FANCY");
Added / After Commit
+ diff --git a/src/modules/horse/pages/Market/AddMarket.tsx b/src/modules/horse/pages/Market/AddMarket.tsx + index 2458326..9d26f4b 100644 + + const MARKET_TYPES = ["WIN", "2PLACES", "3PLACES", "4PLACES", "FANCY"]; + const MARKET_ODDS_TYPES = ["IndianManual", "ToteMarket"]; + const FANCY_TYPES = ["DEFAULT", "OBJECTION", "ODDS & EVENS", "PHOTO", "JODI OF", "TRIO OF", "COMBO OF", "SUPER COMBO OF"]; + const RUNNER_NAME_FANCY_TYPES = ["JODI OF", "TRIO OF", "COMBO OF", "SUPER COMBO OF"]; + const MARKET_TYPE_RUNNER_REQUIREMENTS: Record<string, number> = { + WIN: 1, + "2PLACES": 2, + const DEFAULT_MARKET_ODDS_TYPE = "IndianManual"; + const TOTAL_ROWS = 25; + + const needsRunnerSelection = (fancyType?: string) => + fancyType === "PHOTO" || RUNNER_NAME_FANCY_TYPES.includes(fancyType || ""); + + const shouldBuildRunnerMarketName = (fancyType?: string) => + RUNNER_NAME_FANCY_TYPES.includes(fancyType || "");
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx - index 4608a28..aeb0295 100644 - /> - - {/* ── Top card ── */} - <div className="custom-card card mb-3"> - <div className="card-body py-3"> - - {/* Controls row */} - <div className="d-flex align-items-center gap-4 flex-wrap mb-3"> - <div className="d-flex align-items-center gap-2"> - <div style={{ lineHeight: 1.1 }}> - <div className="text-muted" style={{ fontSize: 13 }}>Active All</div> - </div> - <button - type="button" - className="btn btn-primary btn-sm ms-auto" - onClick={() => void saveMarkets()}
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx + index 4608a28..aeb0295 100644 + /> + + {/* ── Top card ── */} + <div className="custom-card card mb-3 horse-admin-market-card"> + <div className="card-body py-3"> + + {/* Controls row */} + <div className="horse-admin-controls-row mb-3"> + <div className="d-flex align-items-center gap-2"> + <div style={{ lineHeight: 1.1 }}> + <div className="text-muted" style={{ fontSize: 13 }}>Active All</div> + </div> + <button + type="button" + className="btn btn-primary btn-sm horse-admin-save-btn" + onClick={() => void saveMarkets()}
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx - index 439ab4a..71a60bf 100644 - - const RUNNER_TEXT_LIMIT = 10; - - const truncateText = (text?: string | number | null, limit = RUNNER_TEXT_LIMIT) => { - const value = text === null || text === undefined ? "" : String(text); - - markets.map((m: any, i: number) => { - const isOpen = m.is_active === "active" || m.is_active === true || m.is_active === "active" || m.is_active === "Active" || m.is_active === "Active"; - const isSettled = m.settle === true; - const fancy = isFancyMarket(m); - - return ( - <td>{m.marketName || m.market_name || "-"}</td> - <td>{m.marketType || m.market_type || "-"}</td> - <td>{m.runners ?? m.runners_count ?? "-"}</td> - <td>
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx + index 439ab4a..71a60bf 100644 + + const RUNNER_TEXT_LIMIT = 10; + + + const truncateText = (text?: string | number | null, limit = RUNNER_TEXT_LIMIT) => { + const value = text === null || text === undefined ? "" : String(text); + + markets.map((m: any, i: number) => { + const isOpen = m.is_active === "active" || m.is_active === true || m.is_active === "active" || m.is_active === "Active" || m.is_active === "Active"; + const isSettled = m.settle === true; + + const disableMarketStatus = isVoid || isSettled; + const fancy = isFancyMarket(m); + + return ( + <td>{m.marketName || m.market_name || "-"}</td>
Removed / Before Commit
- diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css - index 603fde6..bafe0ff 100644 - margin-left: 0; - } - - .horse-flag-cell { - padding: 0.5rem 0; - } - justify-content: space-between; - gap: 1rem; - } - }
Added / After Commit
+ diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css + index 603fde6..bafe0ff 100644 + margin-left: 0; + } + + .horse-admin-market-card, + .horse-admin-detail-card { + max-width: 100%; + overflow: hidden; + } + + .horse-admin-controls-row { + display: flex; + align-items: center; + gap: 1rem 1.5rem; + flex-wrap: wrap; + } +