Skip to content

Commit

Permalink
merge changes from RetroAchievements#1936
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras committed Oct 27, 2023
1 parent a4725ff commit a354bb2
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 390 deletions.
9 changes: 4 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ FORWARD_MAILPIT_PORT=64051
FORWARD_MEILISEARCH_PORT=64060
FORWARD_PHPMYADMIN_PORT=64080

# Feature Flags

FEATURE_BEAT=true

# Application

APP_NAME=RetroAchievements
Expand Down Expand Up @@ -88,11 +92,6 @@ MAIL_PASSWORD="${DB_USERNAME}"
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="${APP_NAME}"

# Feature Flags

FEATURE_BEAT=true
FEATURE_AGGREGATE_QUERIES=true

# Providers

CLAMAV_SKIP_VALIDATION=true
Expand Down
56 changes: 0 additions & 56 deletions app/Helpers/database/player-game.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,59 +695,3 @@ function getGameTopAchievers(int $gameID): array

return $retval;
}

function getMostPopularGames(int $offset, int $count, int $method): array
{
$retval = [];

if ($method == 0) {
// By num awards given:
$query = " SELECT gd.ID, gd.Title, gd.ConsoleID, gd.ForumTopicID, gd.Flags, gd.ImageIcon, gd.ImageTitle, gd.ImageIngame, gd.ImageBoxArt, gd.Publisher, gd.Developer, gd.Genre, gd.Released, gd.IsFinal, gd.TotalTruePoints, c.Name AS ConsoleName, SUM(NumTimesAwarded) AS NumRecords
FROM GameData AS gd
LEFT JOIN Console AS c ON c.ID = gd.ConsoleID
LEFT OUTER JOIN (
SELECT
COALESCE(aw.cnt, 0) AS NumTimesAwarded,
GameID
FROM
Achievements AS ach
LEFT OUTER JOIN (
SELECT
AchievementID,
count(*) cnt
FROM
Awarded
GROUP BY
AchievementID) aw ON ach.ID = aw.AchievementID
GROUP BY
ach.ID) aw ON aw.GameID = gd.ID
GROUP BY gd.ID
ORDER BY NumRecords DESC
LIMIT $offset, $count";
} else {
return $retval;
// $query = " SELECT COUNT(*) AS NumRecords, Inner1.*
// FROM
// (
// SELECT gd.ID, gd.Title, gd.ConsoleID, gd.ForumTopicID, gd.Flags, gd.ImageIcon, gd.ImageTitle, gd.ImageIngame, gd.ImageBoxArt, gd.Publisher, gd.Developer, gd.Genre, gd.Released, gd.IsFinal, gd.TotalTruePoints, c.Name AS ConsoleName
// FROM Activity AS act
// LEFT JOIN GameData AS gd ON gd.ID = act.data
// LEFT JOIN Console AS c ON c.ID = gd.ConsoleID
// WHERE act.activitytype = " . AchievementFlag::OfficialCore . " AND !ISNULL( gd.ID )
// GROUP BY gd.ID, act.User
// ) AS Inner1
// GROUP BY Inner1.ID
// ORDER BY NumRecords DESC
// LIMIT $offset, $count";
}

$dbResult = s_mysql_query($query);

if ($dbResult !== false) {
while ($data = mysqli_fetch_assoc($dbResult)) {
$retval[] = $data;
}
}

return $retval;
}
4 changes: 0 additions & 4 deletions app/Platform/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
use App\Platform\Commands\SyncLeaderboardEntries;
use App\Platform\Commands\SyncLeaderboards;
use App\Platform\Commands\SyncMemoryNotes;
use App\Platform\Commands\SyncPlayerAchievements;
use App\Platform\Commands\SyncPlayerBadges;
use App\Platform\Commands\SyncPlayerGames;
use App\Platform\Commands\SyncPlayerRichPresence;
use App\Platform\Commands\SyncPlayerSession;
use App\Platform\Commands\UnlockPlayerAchievement;
Expand Down Expand Up @@ -91,8 +89,6 @@ public function boot(): void
SyncLeaderboards::class,
SyncLeaderboardEntries::class,
SyncMemoryNotes::class,
SyncPlayerAchievements::class,
SyncPlayerGames::class,
SyncPlayerBadges::class,
SyncPlayerRichPresence::class,
SyncPlayerSession::class,
Expand Down
99 changes: 0 additions & 99 deletions app/Platform/Commands/SyncPlayerAchievements.php

This file was deleted.

70 changes: 0 additions & 70 deletions app/Platform/Commands/SyncPlayerGames.php

This file was deleted.

6 changes: 3 additions & 3 deletions app/Platform/Commands/UpdateGamePlayerGames.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace App\Platform\Commands;

use App\Platform\Actions\UpdateGamePlayerGames as UpdateOutdatedPlayerGameMetricsAction;
use App\Platform\Actions\UpdateGamePlayerGames as UpdatePlayerGameMetricsAction;
use App\Platform\Models\Game;
use Illuminate\Console\Command;

Expand All @@ -15,7 +15,7 @@ class UpdateGamePlayerGames extends Command
protected $description = "Update game(s) outdated player game metrics";

public function __construct(
private readonly UpdateOutdatedPlayerGameMetricsAction $updateOutdatedPlayerGameMetrics
private readonly UpdatePlayerGameMetricsAction $updatePlayerGameMetrics
) {
parent::__construct();
}
Expand All @@ -31,7 +31,7 @@ public function handle(): void
$progressBar->start();

foreach ($games as $game) {
$this->updateOutdatedPlayerGameMetrics->execute($game);
$this->updatePlayerGameMetrics->execute($game);
$progressBar->advance();
}

Expand Down
37 changes: 0 additions & 37 deletions config/sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,43 +304,6 @@
// ],
// ],

/*
* Awarded 60000k incremental by Date
*
* Populates player_achievements and player_games
*
* @see \App\Platform\Commands\SyncPlayerAchievements
*/
'player_achievements' => [
'model' => PlayerAchievement::class,
'strategy' => SyncStrategy::UPSERT,
'reference_model' => PlayerAchievementLegacy::class,
'reference_key' => 'Date',
'unique_key' => ['user_id', 'achievement_id'],
'require' => [
],
'map' => [
/* no map. everything is handled in preProcessEntity */
],
],

/*
* syncing from Activity (type 3 = started playing) is too expensive
* sync from player achievements instead
*/
'player_games' => [
'model' => PlayerGame::class,
'strategy' => SyncStrategy::UPSERT,
'reference_model' => PlayerAchievement::class,
'reference_key' => PlayerAchievement::CREATED_AT,
'unique_key' => ['user_id', 'game_id'],
'require' => [
],
'map' => [
/* no map. everything is handled in preProcessEntity */
],
],

/*
* SiteAwards 106k incremental by AwardDate
*/
Expand Down
Loading

0 comments on commit a354bb2

Please sign in to comment.