Showing AI reviews for army
Project AI Score ?
67%
Quality Avg ?
72%
Security Avg ?
54%
Reviews ?
37

Review Result ?

jattin01/army · f3c7826d
The commit introduces moderate changes involving database queries and view updates. However, the commit message is not descriptive, and some commented-out code is left in the views. There are no clear security improvements or testing aspects added. The use of inline functions in queries is modern but needs careful review to avoid bugs. The changes have some business relevance but are not clearly communicated.
Quality ?
60%
Security ?
50%
Business Value ?
55%
Maintainability ?
60%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Issue
Where commit message
Issue / Evidence issue
Suggested Fix provide a detailed and descriptive commit message explaining the purpose and impact of the changes
Commented Out Code Present
Where resources/views/demand/otherindex.blade.php:95
Issue / Evidence commented out code present
Suggested Fix remove commented-out code to improve code maintainability and clarity
Ambiguous Query Condition
Where app/Http/Controllers/ProductionDemandController.php:165
Issue / Evidence ambiguous query condition
Suggested Fix add comments or clarify query logic especially for 'whereDoesntHave' with closures to reduce bug risk
Unclear Variable Naming And Update
Where resources/views/demand/otherspares.blade.php:348
Issue / Evidence unclear variable naming and update
Suggested Fix improve variable naming and add comments explaining the logic behind quantity calculations to improve quality and reduce bug risk
Code Change Preview · app/Http/Controllers/ProductionDemandController.php ?
Removed / Before Commit
- ->whereHas('repairClass', fn($r) => $r->where('name','!=','CL A')))
- ->pluck('job_no','id');
- 
-         $equipments = WorkEquipment::select('work_order_id')->where('main_eqpt', $selectedEquipment)
- ->whereNull('wcn_number')
- ->whereHas('workOrder', function ($query) {
- $query->whereNotNull('job_no')
- ->where('job_no', '!=', '')
- ->whereNotNull('control_no')
- ->where('control_no', '!=', '');
- })
-             ->whereHas('RepairClass', fn($q) => $q->where('name','!=','CL A'))
- ->when($selectedJob, fn($q) => $q->where('work_order_id', $selectedJob))
- ->groupBy('work_order_id')
- ->get();
- }
- 
- return view('demand.otherindex', compact(
Added / After Commit
+ ->whereHas('repairClass', fn($r) => $r->where('name','!=','CL A')))
+ ->pluck('job_no','id');
+ 
+         $equipments = WorkEquipment::selectRaw('MAX(id) as id, work_order_id')
+             ->where('main_eqpt', $selectedEquipment)
+ ->whereNull('wcn_number')
+ ->whereHas('workOrder', function ($query) {
+ $query->whereNotNull('job_no')
+ ->where('job_no', '!=', '')
+ ->whereNotNull('control_no')
+ ->where('control_no', '!=', '');
+ })
+             ->whereDoesntHave('RepairClass', fn($q) => $q->where('name','CL A'))
+ ->when($selectedJob, fn($q) => $q->where('work_order_id', $selectedJob))
+ ->groupBy('work_order_id')
+ ->get();
+ 
+ }
Removed / Before Commit
- <td><input type="checkbox" class="job-checkbox" value="{{ $eq->work_order_id }}"></td>
- <td>{{ $eq->workOrder->job_no ?? '-' }}</td>
- <td>
-                             <a href="#"><i class="fa fa-eye" style="color: #008cff;background:white"></i></a>
- </td>
- </tr>
- @endforeach
Added / After Commit
+ <td><input type="checkbox" class="job-checkbox" value="{{ $eq->work_order_id }}"></td>
+ <td>{{ $eq->workOrder->job_no ?? '-' }}</td>
+ <td>
+                             <!-- <a href="{{ route('demand.spares', $eq->id) }}">
+                                 <i class="fa fa-file-signature"></i> 
+                             </a> -->
+                             <a href="{{ route('demand.previous.details', ['demand_id' => $eq->id]) }}" title="View Previous Details">
+                                 <i class="fa fa-eye" style="color: #008cff;background:white"></i>
+                             </a>
+                             
+ </td>
+ </tr>
+ @endforeach
Removed / Before Commit
- 
- $(this).val(val);
- 
- // 🟢 Step 3: divide qty among selected
- const baseQty = Math.floor(val / selectedIds.length);
- let remainder = val % selectedIds.length;
- 
- // Send AJAX per regId and regNo
- sendDraftUpdate(
-                 { ...spare, qty_demanded: qtyForReg }, // spare
- qtyForReg,                             // qty
- regNo,                                 // reg_no
- [regId]                                // regIds
Added / After Commit
+ 
+ $(this).val(val);
+ 
+         val  = val + alreadyDemandedTotal;
+ // 🟢 Step 3: divide qty among selected
+ const baseQty = Math.floor(val / selectedIds.length);
+ let remainder = val % selectedIds.length;
+ 
+ // Send AJAX per regId and regNo
+ sendDraftUpdate(
+                 { ...spare, qty_demanded: qtyForReg}, // spare
+ qtyForReg,                             // qty
+ regNo,                                 // reg_no
+ [regId]                                // regIds