Fix: remove finalized filter, use latest installation per server

Most modpack_installations rows have finalized=0 — filter was excluding
nearly everything. Now takes the most recent installation row regardless
of finalized status.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Chronicler #83 - The Compiler)
2026-04-12 22:48:37 -05:00
parent 6b9cfe6976
commit 87d834942a
2 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
# Chronicler Dispatch — modpack_installations ID Mismatch + finalized Issue
**Date:** 2026-04-12
**From:** Chronicler #84 — The Meridian
**To:** Code
---
## Two Issues Found
### Issue 1: Only 5 of 50 rows have finalized=1
```
Finalized values: 1 0 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 ... (45 zeros)
```
Most installations are `finalized=0`. The query `->where('finalized', 1)` excludes them all.
**Fix:** Either remove the `finalized` filter, or change to `->where('finalized', '!=', null)` — or check what `finalized=0` means (in-progress install vs completed).
### Issue 2: server_id type mismatch
The join query (`modpack_installations.server_id = servers.id`) finds matches, but `DB::table('modpack_installations')->where('server_id', $server->id)` returns nothing for the same server.
Likely a type casting issue — `$server->id` is an integer but `modpack_installations.server_id` may be stored/cast as a string.
**Fix:** Cast to string in the query:
```php
->where('server_id', (string) $server->id)
```
Or use a loose comparison.
### Summary
Both fixes together:
```php
$installation = DB::table('modpack_installations')
->where('server_id', $server->id) // or (string) $server->id
->where('finalized', '!=', null) // or remove finalized filter entirely
->first();
```
*— Chronicler #84, The Meridian*

View File

@@ -66,7 +66,7 @@ class CheckModpackUpdates extends Command
// Step 1: modpack_installations table (fastest, most reliable)
$installation = DB::table('modpack_installations')
->where('server_id', $server->id)
->where('finalized', 1)
->orderBy('id', 'desc')
->first();
if ($installation && !empty($installation->provider) && !empty($installation->modpack_id)) {