Skip to content

Commit

Permalink
Fix map name (#1173)
Browse files Browse the repository at this point in the history
* Revert "chore: removed " - Ranked" from map names (#1158)"

This reverts commit dc71868.

* fix: redo maps during save to drop " - Ranked"
  • Loading branch information
iBotPeaches authored Feb 21, 2024
1 parent 11fd6b6 commit 53d7920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions app/Models/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

/**
* @property int $id
Expand Down Expand Up @@ -51,6 +52,11 @@ public static function fromDotApi(array $payload): ?self
$levelId = Arr::get($payload, 'id');
$levelName = Arr::get($payload, 'name');

// HACK - The API started adding " - Ranked" to Ranked Maps.
// This has caused data accuracy issues due to older ranked maps not having this suffix.
// We will remove this suffix from the name to ensure we can match the level correctly.
$levelName = Str::remove(' - Ranked', $levelName);

/** @var Level $level */
$level = self::query()
->where('uuid', $levelId)
Expand Down
5 changes: 0 additions & 5 deletions app/Models/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public function getImageAttribute(): string
return $this->thumbnail_url;
}

public function getNameAttribute(): string
{
return Str::remove(' - Ranked', $this->attributes['name'] ?? '');
}

public static function fromDotApi(array $payload): ?self
{
$mapId = Arr::get($payload, 'id');
Expand Down

0 comments on commit 53d7920

Please sign in to comment.