From 34f40d6dbc5d149f2dd8a072fa7e138682262487 Mon Sep 17 00:00:00 2001 From: Vari Date: Wed, 6 Mar 2024 18:41:04 +0100 Subject: [PATCH] Fixed some ->save() statements in progression. --- .../Http/Controllers/Api/Matchmaking/MatchmakingController.php | 3 +++ dist/app/Http/Controllers/Api/Player/ChallengeController.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/app/Http/Controllers/Api/Matchmaking/MatchmakingController.php b/dist/app/Http/Controllers/Api/Matchmaking/MatchmakingController.php index 573664d..d29f8df 100644 --- a/dist/app/Http/Controllers/Api/Matchmaking/MatchmakingController.php +++ b/dist/app/Http/Controllers/Api/Matchmaking/MatchmakingController.php @@ -152,6 +152,8 @@ public function playerEndOfMatch(PlayerEndOfMatchRequest $request) } } + $characterData->save(); + foreach ($request->earnedCurrencies as $earnedCurrency) { switch ($earnedCurrency['currencyName']) { case 'CurrencyA': @@ -164,6 +166,7 @@ public function playerEndOfMatch(PlayerEndOfMatchRequest $request) $playerData->currency_c += $earnedCurrency['amount']; } } + $playerData->save(); $this->removeUserFromGame($user, $game); diff --git a/dist/app/Http/Controllers/Api/Player/ChallengeController.php b/dist/app/Http/Controllers/Api/Player/ChallengeController.php index 7d44e38..003dd17 100644 --- a/dist/app/Http/Controllers/Api/Player/ChallengeController.php +++ b/dist/app/Http/Controllers/Api/Player/ChallengeController.php @@ -92,7 +92,7 @@ public function executeChallengeProgressionBatch(ExecuteChallengeProgressionBatc if($operation['operationName'] === 'complete') $this->setChallengeAsCompleted($challengeId, $user); else - $this->addProgressToChallenge($challengeId, round($operation['operationsData']['value']), $user); + $this->addProgressToChallenge($challengeId, round($operation['operationData']['value']), $user); $processedChallenges[] = $challengeId; } } @@ -126,6 +126,7 @@ protected function setChallengeAsCompleted(string $challengeId, User $user) $foundChallenge->playerData()->updateExistingPivot($user->playerData()->id, [ 'progress' => $foundChallenge->completion_value, ]); + $foundChallenge->save(); return; }