AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
67%
Quality Avg
?
69%
Security Avg
?
64%
Reviews
?
143
Review Result ?
solutionbowl/tenant-service · f2ff9c72
The commit adds extensive console logging for multi-bet settlement processing and introduces a RacingBet schema supporting multi-bet legs. The added logs improve traceability but clutter production code and reduce quality. The RacingBet schema addition adds business value for multi-bet functionality but lacks validations, e.g. on odds fields. There are minor bug risks due to reliance on console logs without centralized logging control. Security-wise, printing potentially sensitive IDs to logs and insufficient data validation lower the score. The commit message is vague and does not describe changes well, adding to risk of misunderstanding or fake work.
Quality
?
75%
Security
?
50%
Business Value
?
65%
Maintainability
?
68%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Lack Of Meaningful Description
Where
commit message
Issue / Evidence
lack of meaningful description
Suggested Fix
improve commit message to clearly describe changes and intent
Excessive Console.log Statements Clutter P...
Where
src/controllers/horseracing/result.controller.js:305
Issue / Evidence
excessive console.log statements clutter production
Suggested Fix
replace console.log with structured logging with different levels or remove non-essential logs
Error Messages Only Print Error.message
Where
src/controllers/horseracing/result.controller.js:428
Issue / Evidence
error messages only print error.message
Suggested Fix
consider logging stack trace for improved debugging
Missing Validation
Where
src/models/RacingBet.js:10
Issue / Evidence
odds_request lacks validation
Suggested Fix
add validation or minimum/maximum constraints to odds_request and odds_matched fields
Missing Validation
Where
src/models/RacingBet.js:12
Issue / Evidence
runner_id has no validation or required flag
Suggested Fix
consider appropriateness based on business rules and add required/validation if needed
Betids Logged May Contain Sensitive Identi...
Where
src/controllers/horseracing/result.controller.js:346
Issue / Evidence
betIds logged may contain sensitive identifiers
Suggested Fix
review whether these should be redacted or obfuscated in logs
Code Change Preview · src/controllers/horseracing/result.controller.js
?
Removed / Before Commit
- diff --git a/src/controllers/horseracing/result.controller.js b/src/controllers/horseracing/result.controller.js - index d0d81de..37ece4c 100644 - // 🆕 MULTI-BET SETTLEMENT - // â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• - // Settle all multi-bet legs for this race - await settleMultiBetLegs(eventObjectId); - - return res.json({ - */ - async function settleMultiBetLegs(raceId) { - try { - // 1. Find all PENDING multi-bet legs for this race - const pendingLegs = await RacingBet.find({ - event_id: raceId, - leg_status: "PENDING" - }).lean(); - - if (!pendingLegs.length) {
Added / After Commit
+ diff --git a/src/controllers/horseracing/result.controller.js b/src/controllers/horseracing/result.controller.js + index d0d81de..37ece4c 100644 + // 🆕 MULTI-BET SETTLEMENT + // â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• + // Settle all multi-bet legs for this race + console.log(`[Multi-bet Settlement] Processing race ${eventObjectId}`); + await settleMultiBetLegs(eventObjectId); + + return res.json({ + */ + async function settleMultiBetLegs(raceId) { + try { + // 1. Find all PENDING multi-bet legs for this race (without .lean() so we can save) + const pendingLegs = await RacingBet.find({ + event_id: raceId.toString(), + leg_status: "PENDING" + }); +
Removed / Before Commit
- diff --git a/src/controllers/runnerScrapingController.js b/src/controllers/runnerScrapingController.js - index 28a0d41..8361919 100644 - // Look backwards from table for race title patterns - const $prevElements = $raceTable.prevAll(); - - for (let j = 0; j < Math.min(10, $prevElements.length); j++) { - const $el = $($prevElements[j]); - const text = clean($el.text()); - - // Pattern 1: "1 (65) The Circar Plate" or "The Circar Plate" - const match1 = text.match(/^(\d+)?\s*\(?\d*\)?\s*(The\s+[A-Z][A-Za-z\s]+?)\s*(?:Class|Maiden|For|$)/i); - if (match1) { - if (match1[1]) raceNumber = match1[1]; - raceTitle = clean(match1[2]); - break; - } - - // Pattern 2: Simple "The [Title] Plate/Cup/Stakes"
Added / After Commit
+ diff --git a/src/controllers/runnerScrapingController.js b/src/controllers/runnerScrapingController.js + index 28a0d41..8361919 100644 + // Look backwards from table for race title patterns + const $prevElements = $raceTable.prevAll(); + + for (let j = 0; j < Math.min(15, $prevElements.length); j++) { + const $el = $($prevElements[j]); + const text = clean($el.text()); + const tagName = $el.prop("tagName"); + + // Skip empty or very short text + if (!text || text.length < 5) continue; + + // Pattern 1: "1 (65) The Circar Plate Class 4" + const match1 = text.match(/^(\d+)?\s*\(?\d*\)?\s*(The\s+[A-Z][A-Za-z\s]+?)\s*(?:Class|Maiden|For|Handicap|Div)/i); + if (match1) { + if (match1[1]) raceNumber = match1[1]; + raceTitle = clean(match1[2]);
Removed / Before Commit
- diff --git a/src/models/RacingBet.js b/src/models/RacingBet.js - index 2ecd891..860c3b9 100644 - const mongoose = require("mongoose"); - - const RacingBetSchema = new mongoose.Schema({}, { strict: false }); - - module.exports = mongoose.model("RacingBet", RacingBetSchema);
Added / After Commit
+ diff --git a/src/models/RacingBet.js b/src/models/RacingBet.js + index 2ecd891..860c3b9 100644 + const mongoose = require("mongoose"); + + const RacingBetSchema = new mongoose.Schema({ + bet_id: { type: mongoose.Schema.Types.ObjectId, ref: "Bet", required: true }, + event_id: { type: String, required: true }, + market_name: { type: String, required: true }, + market_odds_type: { type: String, required: true, default: "IndianManual" }, + selection_name: { type: String, required: true }, + market_id: { type: String, required: true }, + odds_request: { type: Number, required: true }, + odds_matched: { type: Number }, + runner_id: { type: String }, + + // Multi-bet support + leg_number: { type: Number, default: 1 }, + leg_status: {