Only display last 28 days on stats page (excluding current day)
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Hentai;
|
||||
use App\Models\PopularMonthly;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -46,6 +47,8 @@ class HentaiApiController extends Controller
|
||||
// Cache for 60 minutes
|
||||
$data = Cache::remember('api_monthly_views', now()->addMinutes(60), function () {
|
||||
return PopularMonthly::selectRaw('DATE(created_at) as date, COUNT(*) as count')
|
||||
->whereDate('created_at', '<', Carbon::today())
|
||||
->whereDate('created_at', '>=', Carbon::today()->subDays(28))
|
||||
->groupBy('date')
|
||||
->orderBy('date', 'asc')
|
||||
->get();
|
||||
|
||||
@@ -34,7 +34,7 @@ window.axios.get('/v1/monthly-views').then(function (response) {
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Views the last 30 days',
|
||||
text: 'Views the last 28 days',
|
||||
font: {
|
||||
size: 18
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user