Skip to content

Commit

Permalink
Fix the previous data saving implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kejax committed Mar 30, 2024
1 parent b061173 commit 03f3b3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion routes/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@

$history = PlanetHistory::orderBy('updated_at', 'DESC')->where('index', $planet['index'])->first();

if ($history && $history->makeHidden(['created_at', 'updated_at', 'id'])->toArray() == $planet) {
if ($history && (
$history->owner == $planet['owner'] &&
$history->health == $planet['health'] &&
round($history->regenPerSecond, 2) == round($planet['regenPerSecond'], 2) &&
$history->players == $planet['players']
)) {
$history->touch();
} else {
PlanetHistory::create($planet);
Expand Down

0 comments on commit 03f3b3c

Please sign in to comment.