Showing AI reviews for tenant-service
Project AI Score ?
67%
Quality Avg ?
69%
Security Avg ?
64%
Reviews ?
143

Review Result ?

solutionbowl/tenant-service · d07e4dfa
This commit adds a helper function to parse horse number and gate number from a value, improving data extraction clarity. The function is used in several locations to standardize how horse and gate numbers are extracted, which likely reduces bugs and improves maintainability. However, the handling of the fallback case where both horseNo and gateNo default to the same value could lead to confusion or data quality issues if not properly validated.
Quality ?
75%
Security ?
80%
Business Value ?
70%
Maintainability ?
73%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Incomplete Error Handling On Non Matched V...
Where src/controllers/runnerScrapingController.js:18
Issue / Evidence incomplete error handling on non-matched values
Suggested Fix consider returning separate defaults or validating input format to reduce ambiguity
Gateno Assignment Logic Might Cause Gateno...
Where src/controllers/runnerScrapingController.js:431
Issue / Evidence gateNo assignment logic might cause gateNo to equal horseNo unintentionally
Suggested Fix clarify logic or add comments
Lack Of Descriptive Detail
Where commit message
Issue / Evidence lack of descriptive detail
Suggested Fix improve message to clearly summarize purpose and impact of changes
Code Change Preview · src/controllers/runnerScrapingController.js ?
Removed / Before Commit
- diff --git a/src/controllers/runnerScrapingController.js b/src/controllers/runnerScrapingController.js
- index 6ee9854..af40ce3 100644
- return (value || "").replace(/\s+/g, " ").trim();
- }
- 
- /**
- * Detect website type from URL
- */
- // Gate from Dr column or H.No
- let gateNo = horseNo;
- if (isRacecard) {
-           // For RACECARD: Use H.No (column 0) as gate
-           gateNo = horseNo;
- } else {
- // For RESULT: Dr is at index 8
- if (tds.length > 8) {
- gateNo = drValue;
- }
Added / After Commit
+ diff --git a/src/controllers/runnerScrapingController.js b/src/controllers/runnerScrapingController.js
+ index 6ee9854..af40ce3 100644
+ return (value || "").replace(/\s+/g, " ").trim();
+ }
+ 
+ function splitHorseAndGateNo(value) {
+   const rawValue = clean(value);
+   const match = rawValue.match(/^(.+?)\s*\(([^)]+)\)\s*$/);
+ 
+   if (!match) {
+     return {
+       horseNo: rawValue,
+       gateNo: rawValue,
+     };
+   }
+ 
+   return {
+     horseNo: clean(match[1]),