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

Review Result ?

solutionbowl/crm-dashbaord · 9ebdfd34
This commit introduces a well-scoped enhancement to the handling of percentage values on the Punching page by adding support for fancy market types and percent inputs. The changes improve UX by allowing inputs for back and lay percentages with live calculations of adjusted odds and automatic saving. The code is clean with appropriate use of React hooks and types. Some duplication exists across handling of winner and fancy markets that could be refactored. There is low bug risk but a slight chance of regression in market state synchronization. Security risks are minimal as the changes mainly focus on UI state and data handling within the frontend.
Quality ?
85%
Security ?
95%
Business Value ?
80%
Maintainability ?
83%
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/AdminRacepage.tsx:110
Issue / Evidence Consider extracting isFancyMarketType function into a common utility to reduce duplication in AdminRacepage.tsx and AdminMarketPage.tsx
Suggested Fix change this to improve code reuse and maintainability
Use Stable References For 'Markets' In Han...
Where src/modules/horse/pages/Race/AdminRacepage.tsx:688
Issue / Evidence Use stable references for 'markets' in handleRunnerPercentChange to avoid potential stale closure bugs when using useCallback
Suggested Fix change this to improve bug risk score
1208
Where src/modules/horse/pages/Race/AdminRacepage.tsx:1199
Issue / Evidence 1208
Suggested Fix Synchronizing state for backPctInput and layPctInput can cause multiple re-renders, consider debouncing or batching state updates to optimize performance
1226
Where src/modules/horse/pages/Race/AdminRacepage.tsx:1210
Issue / Evidence 1226
Suggested Fix Consider adding input validation and clamping for percentage inputs to avoid invalid data leading to subtle bugs
1247
Where src/modules/horse/pages/Race/AdminRacepage.tsx:1230
Issue / Evidence 1247
Suggested Fix Add error handling for saveMarkets promise to avoid silent failures on save operations
Code Change Preview · src/modules/horse/pages/Race/AdminRacepage.tsx ?
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx
- index f3c15a6..8429d30 100644
- normalizedName.includes("WINNER")
- );
- };
- const normalizeRunnerName = (runner?: OddsRow["runner"]) => getRunnerName(runner).trim().toUpperCase();
- 
- 
- ? toNullableNumber(oddsRow?.back_percent)
- : hasOwn(oddsRow ?? {}, "backPercent")
- ? toNullableNumber(oddsRow?.backPercent)
-         : undefined,
- lay_percent:
- hasOwn(oddsRow ?? {}, "lay_percent")
- ? toNullableNumber(oddsRow?.lay_percent)
- : hasOwn(oddsRow ?? {}, "layPercent")
- ? toNullableNumber(oddsRow?.layPercent)
-         : undefined,
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx
+ index f3c15a6..8429d30 100644
+ normalizedName.includes("WINNER")
+ );
+ };
+ const isFancyMarketType = (marketType?: string, marketName?: string) => {
+   const normalizedType = normalizeMarketType(marketType);
+   const normalizedName = normalizeMarketType(marketName);
+ 
+   return (
+     normalizedType === "FANCY" ||
+     normalizedName.includes("FANCY")
+   );
+ };
+ const normalizeRunnerName = (runner?: OddsRow["runner"]) => getRunnerName(runner).trim().toUpperCase();
+ 
+ 
+ ? toNullableNumber(oddsRow?.back_percent)
Removed / Before Commit
- diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
- index 8d5dbcf..b380df5 100644
- normalizedName.includes("WINNER")
- );
- };
- const normalizeRunnerName = (runner?: OddsRow["runner"]) => getRunnerName(runner).trim().toUpperCase();
- 
- 
- ? toNullableNumber(oddsRow?.back_percent)
- : hasOwn(oddsRow ?? {}, "backPercent")
- ? toNullableNumber(oddsRow?.backPercent)
-         : undefined,
- lay_percent:
- hasOwn(oddsRow ?? {}, "lay_percent")
- ? toNullableNumber(oddsRow?.lay_percent)
- : hasOwn(oddsRow ?? {}, "layPercent")
- ? toNullableNumber(oddsRow?.layPercent)
-         : undefined,
Added / After Commit
+ diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
+ index 8d5dbcf..b380df5 100644
+ normalizedName.includes("WINNER")
+ );
+ };
+ const isFancyMarketType = (marketType?: string, marketName?: string) => {
+   const normalizedType = normalizeMarketType(marketType);
+   const normalizedName = normalizeMarketType(marketName);
+ 
+   return (
+     normalizedType === "FANCY" ||
+     normalizedName.includes("FANCY")
+   );
+ };
+ const normalizeRunnerName = (runner?: OddsRow["runner"]) => getRunnerName(runner).trim().toUpperCase();
+ 
+ 
+ ? toNullableNumber(oddsRow?.back_percent)