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 · afb545fb
This commit introduces important new fields betStartBeforeInMin and betfairEventId with validation and UI integration in the horse race modules. It adds handlers to open a stats page and improves race type extraction and normalization across several files. The changes increase functionality and business value by allowing more detailed race and betting event metadata and integrating a stats view. Validation reduces risk of bad input but some loose use of any types and broad payload assumptions slightly reduce safety. The security risk is low but consistent input validation should be ensured. Support for nested and multiple race type keys improves robustness. Overall the commit adds meaningful, well-structured capabilities with modest risk.
Quality
?
85%
Security
?
80%
Business Value
?
90%
Maintainability
?
85%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Missing Validation
Where
src/modules/horse/pages/Race/CreateRaces.tsx:154
Issue / Evidence
validation relies on converting string to number without stricter type checks
Suggested Fix
add stronger type validation to prevent edge case bugs
Extractracetype Uses Any Type And Deep Rec...
Where
src/modules/horse/pages/Race/stats.tsx:237
Issue / Evidence
extractRaceType uses any type and deep recursive calls
Suggested Fix
consider typings and guard clauses to improve type safety and prevent potential infinite loops
Normalizing Racetype By Removal Of Non Alp...
Where
src/modules/horse/pages/Race/stats.tsx:274
Issue / Evidence
normalizing raceType by removal of non-alphanumeric chars
Suggested Fix
verify this does not inadvertently alter valid raceType strings and add comments about expected input
Getracetype Fallback Recursion On Unknown...
Where
src/modules/horse/pages/Race/AllRaces.tsx:51
Issue / Evidence
getRaceType fallback recursion on unknown types
Suggested Fix
add explicit null checks and typings for safer behavior
Vague And Contains Typos
Where
commit message
Issue / Evidence
vague and contains typos
Suggested Fix
provide a clearer descriptive commit message emphasizing the feature additions and improvements for maintainability
Code Change Preview · src/modules/horse/pages/Race/AllRaces.tsx
?
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/AllRaces.tsx b/src/modules/horse/pages/Race/AllRaces.tsx - index 56cd83e..b4dd076 100644 - navigate(`/horse/races/admin/${raceId}`); - }; - - const handleOpenStatsPage = (raceId: string) => { - navigate(`/horse/races/stats/${raceId}`); - }; - - const formatTime = (timeString: string) => { - <button - className="btn btn-sm btn-icon btn-secondary btn-wave" - title="Open Stats Page" - onClick={() => handleOpenStatsPage(row._id)} - > - <i className="bi bi-bar-chart-line"></i> - </button>
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AllRaces.tsx b/src/modules/horse/pages/Race/AllRaces.tsx + index 56cd83e..b4dd076 100644 + navigate(`/horse/races/admin/${raceId}`); + }; + + const handleOpenStatsPage = (race: Race) => { + navigate(`/horse/races/stats/${race._id}`, { + state: { raceType: race.raceType }, + }); + }; + + const formatTime = (timeString: string) => { + <button + className="btn btn-sm btn-icon btn-secondary btn-wave" + title="Open Stats Page" + onClick={() => handleOpenStatsPage(row)} + > + <i className="bi bi-bar-chart-line"></i>
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/CreateRaces.tsx b/src/modules/horse/pages/Race/CreateRaces.tsx - index 6aa88a0..04cad98 100644 - race_name: string; - distance: string; - start_time: string; - raceType: string; - status: boolean; - liveUrl: string; - race_name: "", - distance: "", - start_time: "", - raceType: "", - status: true, - liveUrl: "" - race_name: race.race_name, - distance: race.distance, - start_time: formattedStartTime, - raceType: race.raceType || "",
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/CreateRaces.tsx b/src/modules/horse/pages/Race/CreateRaces.tsx + index 6aa88a0..04cad98 100644 + race_name: string; + distance: string; + start_time: string; + betStartBeforeInMin: string; + betfairEventId: string; + raceType: string; + status: boolean; + liveUrl: string; + race_name: "", + distance: "", + start_time: "", + betStartBeforeInMin: "0", + betfairEventId: "", + raceType: "", + status: true, + liveUrl: ""
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/stats.tsx b/src/modules/horse/pages/Race/stats.tsx - index 57bab34..c9f6182 100644 - import React, { Fragment, useCallback, useEffect, useMemo, useState } from "react"; - import { Alert, Badge, Button, Card, Col, Row, Spinner, Table } from "react-bootstrap"; - import { useParams } from "react-router-dom"; - import { toast } from "react-toastify"; - import Pageheader from "../../components/pageheader/pageheader"; - import { tenantServiceInstance as axiosInstance } from "../../../../services/api/axiosConfig"; - }), - })); - - // const formatValue = (value: number | null | undefined) => (value === null || value === undefined ? "-" : `${value}`); - - const formatValue = (value: number | null | undefined) => - - const Stats: React.FC = () => { - const { id: raceId } = useParams<{ id: string }>(); - const [markets, setMarkets] = useState<Market[]>([]);
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/stats.tsx b/src/modules/horse/pages/Race/stats.tsx + index 57bab34..c9f6182 100644 + import React, { Fragment, useCallback, useEffect, useMemo, useState } from "react"; + import { Alert, Badge, Button, Card, Col, Row, Spinner, Table } from "react-bootstrap"; + import { useLocation, useParams } from "react-router-dom"; + import { toast } from "react-toastify"; + import Pageheader from "../../components/pageheader/pageheader"; + import { tenantServiceInstance as axiosInstance } from "../../../../services/api/axiosConfig"; + }), + })); + + const extractRaceType = (payload: any): string => { + const race = + payload?.data?.race ?? + payload?.data?.data?.race ?? + payload?.data?.data ?? + payload?.data ?? + payload?.race ??
Removed / Before Commit
- diff --git a/src/pages/Races/AllRaces.tsx b/src/pages/Races/AllRaces.tsx - index a6375df..3d98185 100644 - - type OwnerRaceApiRow = { - _id?: string; - race_no?: number | string; - race_name?: string; - distance?: string | number; - start_time?: string; - }; - - type RaceRow = { - raceName: string; - distance: string; - startTime: string; - }; - - const formatTime = (value?: string) => {
Added / After Commit
+ diff --git a/src/pages/Races/AllRaces.tsx b/src/pages/Races/AllRaces.tsx + index a6375df..3d98185 100644 + + type OwnerRaceApiRow = { + _id?: string; + id?: string; + race_no?: number | string; + race_name?: string; + distance?: string | number; + start_time?: string; + raceType?: string; + race_type?: string; + race?: unknown; + raceId?: unknown; + race_id?: unknown; + }; + + type RaceRow = {
Removed / Before Commit
- diff --git a/src/pages/Races/stats.tsx b/src/pages/Races/stats.tsx - index a049db8..d08a9d7 100644 - import React, { Fragment, useCallback, useEffect, useMemo, useState } from "react"; - import { Alert, Button, Card, Col, Row, Spinner, Table } from "react-bootstrap"; - import { useParams } from "react-router-dom"; - import { toast } from "react-toastify"; - import Pageheader from "../../components/pageheader/pageheader"; - import { adjustOdd } from "../../modules/horse/utils/odds"; - }; - - type OddsRow = { - runnerId?: string; - runner: Runner; - exposure?: number; - exposureProfit?: number; - betAmount: string; - }; -
Added / After Commit
+ diff --git a/src/pages/Races/stats.tsx b/src/pages/Races/stats.tsx + index a049db8..d08a9d7 100644 + import React, { Fragment, useCallback, useEffect, useMemo, useState } from "react"; + import { Alert, Button, Card, Col, Row, Spinner, Table } from "react-bootstrap"; + import { useLocation, useParams } from "react-router-dom"; + import { toast } from "react-toastify"; + import Pageheader from "../../components/pageheader/pageheader"; + import { adjustOdd } from "../../modules/horse/utils/odds"; + }; + + type OddsRow = { + runnerId?: string; + runner: Runner; + exposure?: number; + exposureProfit?: number; + betAmount: string; + }; +
Removed / Before Commit
- diff --git a/src/services/api/raceService.ts b/src/services/api/raceService.ts - index 0fbecef..b1c3df2 100644 - race_name: string; - distance: string; - start_time: string; - raceType?: string; - status: boolean; - liveUrl?: string; - race_name: string; - distance: string; - start_time: string; - raceType?: string; - status: boolean; - liveUrl?: string; - race_name: string; - distance: string; - start_time: string; - raceType?: string;
Added / After Commit
+ diff --git a/src/services/api/raceService.ts b/src/services/api/raceService.ts + index 0fbecef..b1c3df2 100644 + race_name: string; + distance: string; + start_time: string; + betStartBeforeInMin?: number; + betfairEventId?: string; + raceType?: string; + status: boolean; + liveUrl?: string; + race_name: string; + distance: string; + start_time: string; + betStartBeforeInMin: number; + betfairEventId?: string; + raceType?: string; + status: boolean; + liveUrl?: string;