Showing AI reviews for crm-dashbaord
Project AI Score ?
73%
Quality Avg ?
74%
Security Avg ?
74%
Reviews ?
130

Review Result ?

solutionbowl/crm-dashbaord · 339af741
This commit adds new fields betStartBeforeInMin and betfairEventId with validation and UI input for race management. It improves race type extraction and includes a new 'totemarket' race type check in stats. The changes enhance functionality and user experience of the races module. Minor risks include potential inconsistencies in race type naming (e.g., 'totemarket'), limited input sanitization, and reliance on string manipulation for race type checks.
Quality ?
85%
Security ?
75%
Business Value ?
80%
Maintainability ?
85%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Race Type String Comparison Is Case Insens...
Where src/modules/horse/pages/Race/stats.tsx:214-215
Issue / Evidence Race type string comparison is case-insensitive but might miss typos like 'totemarket' vs 'totemakrket'
Suggested Fix add validation or normalize input strings deeper to reduce bugs.
Security Issue
Where src/modules/horse/pages/Race/stats.tsx:235
Issue / Evidence Normalize raceType using locale-insensitive methods for security and consistency
Suggested Fix consider using locale-aware comparison.
Missing Validation
Where src/modules/horse/pages/Race/CreateRaces.tsx:155-157
Issue / Evidence Validation checks for betStartBeforeInMin could include upper bound or integer type checks to improve input robustness.
Suggested Fix Review and simplify this section.
Trim And Sanitize Betfaireventid Input Mor...
Where src/modules/horse/pages/Race/CreateRaces.tsx:193
Issue / Evidence Trim and sanitize betfairEventId input more thoroughly to avoid injection or invalid data.
Suggested Fix Review and simplify this section.
Issue
Where commit message
Issue / Evidence issue
Suggested Fix clarify commit message to better describe new features and fixes introduced for improved project documentation.
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;