Fix release stats

This commit is contained in:
DariusIII
2024-10-25 12:54:44 +02:00
parent 31868f47cd
commit a0f45c5a46
+7 -4
View File
@@ -20,10 +20,13 @@ class ReleaseStat extends Model
'categories.id')->groupBy('title')->orderByDesc('count')->get();
foreach ($categories as $category) {
self::updateOrCreate([
'category' => $category->title,
'count' => $category->count,
]);
// Check if we already have the information and if we do just update the count
if (self::query()->where('category', $category->title)->exists()) {
self::query()->where('category', $category->title)->update(['count' => $category->count]);
continue;
}
self::query()->create(['category' => $category->title, 'count' => $category->count]);
}
}