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 · 9e6b0812
The commit adds a number formatting function and a UI button for refreshing odds data. It improves user display by formatting numbers to two decimals and adding a refresh button tied to fetching odds. However, there is some duplicated code across similar files (src/modules/horse/pages/Race/stats.tsx and src/pages/Races/stats.tsx) which may reduce maintainability. There is no indication of added tests or error handling around the fetchOdds call, which could elevate bug risk.
Quality
?
70%
Security
?
90%
Business Value
?
50%
Maintainability
?
70%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Duplicate Logic
Where
src/modules/horse/pages/Race/stats.tsx:164
Issue / Evidence
code duplication
Suggested Fix
consider refactoring common functions like formatValue into shared utilities to avoid duplication
Duplicate Logic
Where
src/pages/Races/stats.tsx:183
Issue / Evidence
code duplication
Suggested Fix
consolidate duplicate formatValue function with the one in src/modules/horse/pages/Race/stats.tsx
Missing Error Handling
Where
src/modules/horse/pages/Race/stats.tsx:309
Issue / Evidence
missing error handling
Suggested Fix
add error handling for fetchOdds to improve robustness and reduce bug risk
Missing Error Handling
Where
src/pages/Races/stats.tsx:383
Issue / Evidence
missing error handling
Suggested Fix
add error handling for fetchOdds to improve robustness and reduce bug risk
Lack Of Detail
Where
commit message
Issue / Evidence
lack of detail
Suggested Fix
improve commit message to explain what exactly was fixed or changed regarding stats odds data
Code Change Preview · src/modules/horse/pages/Race/stats.tsx
?
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/stats.tsx b/src/modules/horse/pages/Race/stats.tsx - index 6d50e06..2a5b056 100644 - odds: Array.isArray(market?.odds) ? market.odds.map(normalizeOddsRow) : [], - }); - - const formatValue = (value: number | null | undefined) => (value === null || value === undefined ? "-" : `${value}`); - const multiPlaceMarkets = ["2PLACES", "3PLACES", "4PLACES"]; - - const Stats: React.FC = () => { - <span><i className="ri-checkbox-blank-circle-fill me-1" style={{ color: "#71de7e" }} />Static Volume</span> - </div> */} - <div className="mt-3"> - <div style={{ color: "#6b7280", fontSize: 12, marginBottom: 10 }}>Markets</div> - <div - className="d-flex gap-3 pb-2" - style={{ overflowX: "auto", overflowY: "hidden" }} - </div> - </div>
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/stats.tsx b/src/modules/horse/pages/Race/stats.tsx + index 6d50e06..2a5b056 100644 + odds: Array.isArray(market?.odds) ? market.odds.map(normalizeOddsRow) : [], + }); + + // const formatValue = (value: number | null | undefined) => (value === null || value === undefined ? "-" : `${value}`); + + const formatValue = (value: number | null | undefined) => + value === null || value === undefined + ? "-" + : Number(value).toFixed(2); + + const multiPlaceMarkets = ["2PLACES", "3PLACES", "4PLACES"]; + + const Stats: React.FC = () => { + <span><i className="ri-checkbox-blank-circle-fill me-1" style={{ color: "#71de7e" }} />Static Volume</span> + </div> */} + <div className="mt-3">
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx - index e05b74b..78b3754 100644 - - return ( - <Fragment> - <Pageheader title="Agent Reports" currentpage="Reports" activepage="Agent Reports" /> - <Row> - <Col xl={12}> - <Card className="custom-card">
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx + index e05b74b..78b3754 100644 + + return ( + <Fragment> + <Pageheader title="Agent Reports" currentpage="Agents" activepage="Agent Reports" /> + <Row> + <Col xl={12}> + <Card className="custom-card">
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx - index 36db138..11d50cb 100644 - }; - return ( - <Fragment> - <Pageheader title="All Reports" currentpage="Reports" activepage="All Reports" /> - <Row> - <Col xl={12}> - <Card className="custom-card">
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx + index 36db138..11d50cb 100644 + }; + return ( + <Fragment> + <Pageheader title="Market Reports" currentpage="Market" activepage="All Reports" /> + <Row> + <Col xl={12}> + <Card className="custom-card">
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx - index 25f0acb..5715c12 100644 - <th>Stake</th> - <th>Status</th> - <th>User Win/Loss</th> - <th> Agent Win/Loss</th> - <th>IP Address</th> - </tr> - </thead> - </div> - - {/* Pagination */} - {betsData.pagination && betsData.pagination.totalPages > 1 && ( - <div className="d-flex justify-content-between align-items-center mt-3"> - <div> - Showing page {betsData.pagination.page} of {betsData.pagination.totalPages}
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx + index 25f0acb..5715c12 100644 + <th>Stake</th> + <th>Status</th> + <th>User Win/Loss</th> + <th>Agent Win/Loss</th> + <th>IP Address</th> + </tr> + </thead> + </div> + + {/* Pagination */} + {betsData.pagination && betsData.pagination.totalPages >= 1 && ( + <div className="d-flex justify-content-between align-items-center mt-3"> + <div> + Showing page {betsData.pagination.page} of {betsData.pagination.totalPages}
Removed / Before Commit
- diff --git a/src/modules/horse/utils/odds.tsx b/src/modules/horse/utils/odds.tsx - index c2a155c..3f60ccf 100644 - export const adjustOdd = (value: number | null | undefined) => { - if (value === null || value === undefined) return value; - return value + 1; - }; - \ No newline at end of file
Added / After Commit
+ diff --git a/src/modules/horse/utils/odds.tsx b/src/modules/horse/utils/odds.tsx + index c2a155c..3f60ccf 100644 + export const adjustOdd = (value: number | null | undefined) => { + if (value === null || value === undefined) return value; + return Number((value + 1).toFixed(2)); + }; + \ No newline at end of file
Removed / Before Commit
- diff --git a/src/pages/Races/stats.tsx b/src/pages/Races/stats.tsx - index 637c606..8540f94 100644 - import { useParams } from "react-router-dom"; - import { toast } from "react-toastify"; - import Pageheader from "../../components/pageheader/pageheader"; - import { authService } from "../../services/api/authService"; - import { tenantServiceInstance as axiosInstance } from "../../services/api/axiosConfig"; - import useRaceOddsSocket from "../../modules/horse/hooks/useRaceOddsSocket"; - odds: Array.isArray(market?.odds) ? market.odds.map(normalizeOddsRow) : [], - }); - - const formatValue = (value: number | null | undefined) => (value === null || value === undefined ? "-" : `${value}`); - const formatExposure = (value: number) => (value > 0 ? `+${value}` : `${value}`); - const formatTextValue = (value: string | number | null | undefined) => - value === null || value === undefined || value === "" ? "-" : String(value); - <span><i className="ri-checkbox-blank-circle-fill me-1 stats-legend-icon stats-legend-icon-static" />Static Volume</span> - </div> */} - <div className="mt-3">
Added / After Commit
+ diff --git a/src/pages/Races/stats.tsx b/src/pages/Races/stats.tsx + index 637c606..8540f94 100644 + import { useParams } from "react-router-dom"; + import { toast } from "react-toastify"; + import Pageheader from "../../components/pageheader/pageheader"; + import { adjustOdd } from "../../modules/horse/utils/odds"; + import { authService } from "../../services/api/authService"; + import { tenantServiceInstance as axiosInstance } from "../../services/api/axiosConfig"; + import useRaceOddsSocket from "../../modules/horse/hooks/useRaceOddsSocket"; + odds: Array.isArray(market?.odds) ? market.odds.map(normalizeOddsRow) : [], + }); + + + const formatValue = (value: number | null | undefined) => + value === null || value === undefined + ? "-" + : Number(value).toFixed(2); +