Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinecraft committed Oct 31, 2024
1 parent 0b4490f commit 1c5e84c
Show file tree
Hide file tree
Showing 188 changed files with 1,789 additions and 1,789 deletions.
10 changes: 5 additions & 5 deletions app/Http/Controllers/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ public function index(Request $request)
$responseData = [];
if ($request->user()->can('view admin_dashboard')) {
// KPI for total users
$kpiTotalUsers = User::count();
$kpiTotalUsers = Helper::fastCount('users');
$kpiUserCreatedForInterval = User::where('created_at', '>=', Carbon::now()->subDays(7))->count();
$totalUsersMinusInterval = $kpiTotalUsers - $kpiUserCreatedForInterval ?: 1;
$kpiTotalUserPercent = $kpiTotalUsers !== 0 ? ($kpiUserCreatedForInterval / $totalUsersMinusInterval) * 100 : 0;
$kpiUserLastSeenForInterval = User::where('last_login_at', '>=', Carbon::now()->subDays(7))->count();

// KPI for total players
$kpiTotalPlayers = Player::count();
$kpiTotalPlayers = Player::fastCount();
$kpiPlayerCreatedForInterval = Player::where('created_at', '>=', Carbon::now()->subDays(7))->count();
$totalPlayersMinusInterval = $kpiTotalPlayers - $kpiPlayerCreatedForInterval ?: 1;
$kpiTotalPlayersPercent = $kpiTotalPlayers !== 0 ? ($kpiPlayerCreatedForInterval / $totalPlayersMinusInterval) * 100 : 0;
$kpiPlayerLastSeenForInterval = Player::where('last_seen_at', '>=', Carbon::now()->subDays(7))->count();

// KPI for total posts
$kpiTotalPosts = Post::count();
$kpiTotalPosts = Post::fastCount();
$kpiPostCreatedForInterval = Post::where('created_at', '>=', Carbon::now()->subDays(7))->count();
$totalPostCreatedMinusInterval = $kpiTotalPosts - $kpiPostCreatedForInterval ?: 1;
$kpiTotalPostsPercent = $kpiTotalPosts !== 0 ? ($kpiPostCreatedForInterval / $totalPostCreatedMinusInterval) * 100 : 0;
$kpiTotalComments = Comment::count();
$kpiTotalComments = Comment::fastCount();

// KPI for total failed jobs
$kpiTotalFailedJobs = DB::table('failed_jobs')->count();
$kpiTotalFailedJobs = Helper::fastCount('failed_jobs');
$kpiFailedJobsForInterval = DB::table('failed_jobs')->where('failed_at', '>=', Carbon::now()->subDays(7))->count();
$totalFailedJobsMinusInterval = $kpiTotalFailedJobs - $kpiFailedJobsForInterval ?: 1;
$kpiTotalFailedJobPercent = $kpiTotalFailedJobs !== 0 ? ($kpiFailedJobsForInterval / $totalFailedJobsMinusInterval) * 100 : 0;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PlayerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function index(Request $request, PlayerSettings $playerSettings): \Illumi

$playerActiveLastDay = $playerSettings->last_seen_day_for_active == -1 ? now()->subYears(100) : now()->subDays($playerSettings->last_seen_day_for_active);

$totalPlayersCount = Player::count();
$totalPlayersCount = Player::fastCount();
$activePlayersCount = Player::where('last_seen_at', '>=', $playerActiveLastDay)->count();
$totalPlayTime = Player::sum('play_time');

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1c5e84c

Please sign in to comment.