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

Review Result ?

solutionbowl/crm-dashbaord · fe542573
This commit introduces withdrawal handling for odds on market runner rows, affecting both race and platform admin pages. It disables toggling of active/suspended/inactive states if withdrawn, and propagates withdrawal status across markets for winner or place market types. The changes improve the user experience and data correctness by clearly marking withdrawn odds and preventing contradictory states. The code is generally well structured, but there are repeated patterns in two files that could be further abstracted for maintainability.
Quality ?
85%
Security ?
90%
Business Value ?
75%
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:111-120
Issue / Evidence helper function isWinnerOrPlacesMarketType duplicates logic seen in AdminMarketPage.tsx
Suggested Fix abstract this shared logic to a utility function to reduce duplication and maintenance effort
Long Function
Where src/modules/horse/pages/Race/AdminRacepage.tsx:687-719
Issue / Evidence complex nested map and filter logic for withdrawal propagation could benefit from decomposition into smaller functions for readability and easier testing
Suggested Fix Review and simplify this section.
Same Helper Function Definition As In Admi...
Where src/pages/Platforms/AdminMarketPage.tsx:116-125
Issue / Evidence same helper function definition as in AdminRacepage.tsx, consider extracting shared code
Suggested Fix Review and simplify this section.
Duplicate Logic
Where src/pages/Platforms/AdminMarketPage.tsx:727-761
Issue / Evidence similar complex state update logic repeated, refactor common functionality to a shared method
Suggested Fix Review and simplify this section.
Vague
Where commit message
Issue / Evidence vague
Suggested Fix improve clarity and detail about the business problem and intended user impact of withdrawal feature to help reviewers and maintainers
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 8429d30..281b3d0 100644
- const buildGlobalStateMap = (marketList: Market[]) => {
- const next: Record<string, GlobalState> = {};
- marketList.forEach((market) => {
- next[market.marketId] = {
-       active: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.active),
-       suspended: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.suspended),
-       inactive: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.inactive),
- };
- });
- return next;
- normalizedName.includes("WINNER")
- );
- };
- const isFancyMarketType = (marketType?: string, marketName?: string) => {
- const normalizedType = normalizeMarketType(marketType);
- const normalizedName = normalizeMarketType(marketName);
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx
+ index 8429d30..281b3d0 100644
+ const buildGlobalStateMap = (marketList: Market[]) => {
+ const next: Record<string, GlobalState> = {};
+ marketList.forEach((market) => {
+     const nonWithdrawnOdds = market.odds.filter((oddsRow) => !oddsRow.withdrawn);
+ next[market.marketId] = {
+       active: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.active),
+       suspended: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.suspended),
+       inactive: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.inactive),
+ };
+ });
+ return next;
+ normalizedName.includes("WINNER")
+ );
+ };
+ const isWinnerOrPlacesMarketType = (marketType?: string, marketName?: string) => {
+   const normalizedType = normalizeMarketType(marketType);
Removed / Before Commit
- diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
- index b380df5..535986a 100644
- const buildGlobalStateMap = (marketList: Market[]) => {
- const next: Record<string, GlobalState> = {};
- marketList.forEach((market) => {
- next[market.marketId] = {
-       active: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.active),
-       suspended: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.suspended),
-       inactive: market.odds.length > 0 && market.odds.every((oddsRow) => oddsRow.inactive),
- };
- });
- return next;
- normalizedName.includes("WINNER")
- );
- };
- const isFancyMarketType = (marketType?: string, marketName?: string) => {
- const normalizedType = normalizeMarketType(marketType);
- const normalizedName = normalizeMarketType(marketName);
Added / After Commit
+ diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
+ index b380df5..535986a 100644
+ const buildGlobalStateMap = (marketList: Market[]) => {
+ const next: Record<string, GlobalState> = {};
+ marketList.forEach((market) => {
+     const nonWithdrawnOdds = market.odds.filter((oddsRow) => !oddsRow.withdrawn);
+ next[market.marketId] = {
+       active: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.active),
+       suspended: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.suspended),
+       inactive: nonWithdrawnOdds.length > 0 && nonWithdrawnOdds.every((oddsRow) => oddsRow.inactive),
+ };
+ });
+ return next;
+ normalizedName.includes("WINNER")
+ );
+ };
+ const isWinnerOrPlacesMarketType = (marketType?: string, marketName?: string) => {
+   const normalizedType = normalizeMarketType(marketType);