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

Review Result ?

solutionbowl/crm-dashbaord · 254701c9
This commit introduces comprehensive UI and position handling improvements for horse race market and race details, with a focus on market odds types, dead heat handling, and race settle deductions. The implementation is thorough and includes validation checks for odds and deduction values, improving user input quality and error handling. However, minor improvements in input sanitization and error messaging clarity could be beneficial.
Quality ?
85%
Security ?
90%
Business Value ?
80%
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/Race/RaceDetail.tsx:871
Issue / Evidence input validation is basic and may allow unexpected input
Suggested Fix improve validation logic to better sanitize and validate odds input
Rejection Of Invalid Deduction Inputs Only...
Where src/modules/horse/pages/Race/RaceDetail.tsx:929
Issue / Evidence rejection of invalid deduction inputs only warns user
Suggested Fix improve error feedback/UI state to prevent user confusion
Code Uses Shallow Copy For State Updates W...
Where src/modules/horse/pages/Market/AddMarket.tsx:172
Issue / Evidence code uses shallow copy for state updates without deep cloning nested objects
Suggested Fix verify if deep cloning is needed to avoid unintentional mutations
Focusodds Function Silently Fails For Out ...
Where src/modules/horse/pages/Market/AddMarket.tsx:165
Issue / Evidence focusOdds function silently fails for out-of-bound indices
Suggested Fix add boundary validation and informative handling
Insufficient Detail
Where commit message
Issue / Evidence insufficient detail
Suggested Fix provide more descriptive and detailed message describing all substantive changes made in this commit
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 111bf66..fd1cc82 100644
- import { tenantServiceInstance as axiosInstance } from "../../../../services/api/axiosConfig";
- 
- const MARKET_TYPES = ["WIN", "2PLACES", "3PLACES", "4PLACES", "FANCY"];
- const TOTAL_ROWS   = 25;
- 
- type MarketRow = { market_type: string; market_name: string };
- const EMPTY = (): MarketRow => ({ market_type: "", market_name: "" });
- 
- /* ─── Custom keyboard-friendly dropdown ─────────────────────── */
- interface TypeDropdownProps {
- value: string;
- onChange: (v: string) => void;
-   onEnterAfterSelect: () => void;   // called when user confirms selection → focus market_name
- onArrowDown: () => void;
- onArrowUp: () => void;
- dropRef: (el: HTMLDivElement | null) => void;
Added / After Commit
+ diff --git a/src/modules/horse/pages/Market/AddMarket.tsx b/src/modules/horse/pages/Market/AddMarket.tsx
+ index 111bf66..fd1cc82 100644
+ import { tenantServiceInstance as axiosInstance } from "../../../../services/api/axiosConfig";
+ 
+ const MARKET_TYPES = ["WIN", "2PLACES", "3PLACES", "4PLACES", "FANCY"];
+ const MARKET_ODDS_TYPES = ["IndianManual", "ToteMarket"];
+ const DEFAULT_MARKET_ODDS_TYPE = "IndianManual";
+ const TOTAL_ROWS   = 25;
+ 
+ type MarketRow = { market_type: string; market_odds_type: string; market_name: string };
+ const EMPTY = (): MarketRow => ({
+   market_type: "",
+   market_odds_type: DEFAULT_MARKET_ODDS_TYPE,
+   market_name: "",
+ });
+ 
+ /* ─── Custom keyboard-friendly dropdown ─────────────────────── */
+ interface TypeDropdownProps {
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx
- index 6f3712c..b20c604 100644
- import React, { Fragment, useState, useEffect } from "react";
- import { Card, Col, Row, Spinner, Badge, Modal, Form, Button, Dropdown } from "react-bootstrap";
- import Pageheader from "../../components/pageheader/pageheader";
- import { useNavigate, useParams, useLocation } from "react-router-dom";
- import { toast } from "react-toastify";
- trainer: string;
- status: boolean;
- position?: string;
- position_value?: string | number;
- saved_position?: string | number;
- horse_position?: string | number;
- const isToteMarketRaceType = (raceType?: string | null) =>
- String(raceType ?? "").replace(/[^a-z0-9]/gi, "").toLowerCase() === "totemarket";
- 
- const getToteWinnerOdds = (horse: {
- tote_odds?: string | number | null;
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx
+ index 6f3712c..b20c604 100644
+ import React, { Fragment, useState, useEffect } from "react";
+ import { Card, Col, Row, Spinner, Badge, Modal, Form, Button } from "react-bootstrap";
+ import Pageheader from "../../components/pageheader/pageheader";
+ import { useNavigate, useParams, useLocation } from "react-router-dom";
+ import { toast } from "react-toastify";
+ trainer: string;
+ status: boolean;
+ position?: string;
+     dead_heat?: boolean | string | number | null;
+     deadHeat?: boolean | string | number | null;
+ position_value?: string | number;
+ saved_position?: string | number;
+ horse_position?: string | number;
+ const isToteMarketRaceType = (raceType?: string | null) =>
+ String(raceType ?? "").replace(/[^a-z0-9]/gi, "").toLowerCase() === "totemarket";
+ 
Removed / Before Commit
- diff --git a/src/services/api/raceService.ts b/src/services/api/raceService.ts
- index b1c3df2..17d8fe2 100644
- throw error;
- }
- }
- }
- 
- // Export singleton
Added / After Commit
+ diff --git a/src/services/api/raceService.ts b/src/services/api/raceService.ts
+ index b1c3df2..17d8fe2 100644
+ throw error;
+ }
+ }
+ 
+   async settleRace(
+     id: string,
+     payload: {
+       win_deduction: number;
+       places_deduction: number;
+       fancy_deduction: number;
+     }
+   ): Promise<{ success: boolean; message?: string; data?: any }> {
+     try {
+       const response = await axiosInstance.post(`${this.basePath}/${id}/settle`, payload);
+       return response.data;
+     } catch (error: any) {