Skip to content

Commit

Permalink
#2278 Fixed Archon.gg implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Wotuu committed Jun 5, 2024
1 parent 5f47742 commit 2abcb95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/Models/AffixGroup/AffixGroupEaseTierPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class AffixGroupEaseTierPull extends CacheModel
'last_updated_at',
];

protected $casts = [
'last_updated_at' => 'date',
];

public function affixGroup(): BelongsTo
{
return $this->belongsTo(AffixGroup::class);
Expand Down
8 changes: 4 additions & 4 deletions app/Models/Expansion.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class Expansion extends CacheModel

public $with = ['timewalkingevent'];

protected $dates = [
// 'released_at',
'created_at',
'updated_at',
protected $casts = [
'released_at' => 'date',
'created_at' => 'date',
'updated_at' => 'date',
];

public const EXPANSION_CLASSIC = 'classic';
Expand Down
5 changes: 4 additions & 1 deletion app/Service/AffixGroup/AffixGroupEaseTierService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AffixGroupEaseTierService implements AffixGroupEaseTierServiceInterface
"Dawn of the Infinite: Murozond's Rise" => "Murozond's Rise",
'The Everbloom' => 'Everbloom',
];
public const DATE_TIME_FORMAT = 'Y-m-d\TH:i:sP';

public function __construct(
private readonly SeasonServiceInterface $seasonService,
Expand Down Expand Up @@ -71,16 +72,18 @@ public function parseTierList(array $tierListsResponse): ?AffixGroupEaseTierPull

$result = null;
$tiersHash = $this->getTiersHash($tierListsResponse, array_flip(self::DUNGEON_NAME_MAPPING));
$lastUpdatedAt = Carbon::createFromFormat(self::DATE_TIME_FORMAT, $tierListsResponse['lastUpdated']);

if ($lastEaseTierPull === null ||
$lastEaseTierPull->created_at->isBefore($lastUpdatedAt) ||
$lastEaseTierPull->affix_group_id !== $affixGroup->id ||
$lastEaseTierPull->tiers_hash !== $tiersHash) {

$affixGroupString = $affixGroup->text;
$affixGroupEaseTierPull = AffixGroupEaseTierPull::create([
'affix_group_id' => $affixGroup->id,
'tiers_hash' => $tiersHash,
'last_updated_at' => Carbon::now()->toDateTimeString(),
'last_updated_at' => $lastUpdatedAt,
]);

$dungeonList = Dungeon::active()->get()->keyBy(static function (Dungeon $dungeon) {
Expand Down
2 changes: 1 addition & 1 deletion app/Service/AffixGroup/ArchonApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ArchonApiService implements ArchonApiServiceInterface
*/
public function getDungeonEaseTierListOverall(): array
{
$responseStr = $this->curlGet('https://www.archon.gg/wow/tier-list/dps-rankings/mythic-plus/20/all-dungeons/this-week/data.json');
$responseStr = $this->curlGet('https://www.archon.gg/wow/tier-list/dps-rankings/mythic-plus/10/all-dungeons/this-week/data.json');

$response = json_decode($responseStr, true);

Expand Down

0 comments on commit 2abcb95

Please sign in to comment.