feat: add reusable gallery carousel and ranking feed infrastructure

This commit is contained in:
2026-02-28 07:56:25 +01:00
parent 67ef79766c
commit 6536d4ae78
36 changed files with 3177 additions and 373 deletions

23
scripts/check_stats.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$id = 69478;
$artwork = DB::table('artworks')->where('id', $id)->first();
echo "Artwork: " . ($artwork ? $artwork->title : 'NOT FOUND') . PHP_EOL;
$stats = DB::table('artwork_stats')->where('artwork_id', $id)->first();
echo "artwork_stats row: " . json_encode($stats) . PHP_EOL;
$viewEvents = DB::table('artwork_view_events')->where('artwork_id', $id)->count();
echo "artwork_view_events count: " . $viewEvents . PHP_EOL;
// Check a few artworks that DO have stats
$sample = DB::table('artwork_stats')->whereColumn('views', '>', 'id')->limit(3)->pluck('artwork_id');
echo "Sample artworks with views > 0: " . json_encode($sample) . PHP_EOL;
// Count how many artworks_stats rows exist at all
$total = DB::table('artwork_stats')->count();
echo "Total artwork_stats rows: " . $total . PHP_EOL;

35
scripts/check_stats2.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
$artworkId = 69478;
$stats = DB::table('artwork_stats')->where('artwork_id', $artworkId)->first();
echo "artwork_stats row: " . json_encode($stats) . PHP_EOL;
$events = DB::table('artwork_view_events')->where('artwork_id', $artworkId)->count();
echo "artwork_view_events for {$artworkId}: {$events}" . PHP_EOL;
$latest = DB::table('artwork_view_events')->latest('viewed_at')->take(5)->get(['artwork_id', 'viewed_at', 'session_hash']);
echo "Latest view events (any artwork): " . json_encode($latest) . PHP_EOL;
// Check Redis queue depth
try {
$queueLen = Redis::llen('artwork_stats:deltas');
echo "Redis artwork_stats:deltas queue length: {$queueLen}" . PHP_EOL;
if ($queueLen > 0) {
$peek = Redis::lrange('artwork_stats:deltas', 0, 2);
echo "First entries: " . json_encode($peek) . PHP_EOL;
}
} catch (\Exception $e) {
echo "Redis error: " . $e->getMessage() . PHP_EOL;
}
// Check artwork exists
$artwork = DB::table('artworks')->where('id', $artworkId)->first(['id', 'title', 'status', 'user_id']);
echo "Artwork: " . json_encode($artwork) . PHP_EOL;