From a66a67296864402b258fd3cccde4a29825e085e3 Mon Sep 17 00:00:00 2001 From: Graphictoria Date: Sat, 14 Jan 2023 21:35:51 -0500 Subject: [PATCH] Transaction purchase delta hotfix. --- web/app/Http/Controllers/Api/CommentsController.php | 6 +----- web/app/Models/Transaction.php | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/web/app/Http/Controllers/Api/CommentsController.php b/web/app/Http/Controllers/Api/CommentsController.php index 70b9732..4bc7ce3 100644 --- a/web/app/Http/Controllers/Api/CommentsController.php +++ b/web/app/Http/Controllers/Api/CommentsController.php @@ -46,11 +46,7 @@ class CommentsController extends Controller ]; foreach($comments as $comment) { - $poster = [ - 'name' => $comment->user->username, - 'thumbnail' => $comment->user->getHeadshotImageUrl(), - 'url' => $comment->user->getProfileUrl() - ]; + $poster = $comment->user->userToJson(); $postDate = $comment['updated_at']; if(Carbon::now()->greaterThan($postDate->copy()->addDays(2))) diff --git a/web/app/Models/Transaction.php b/web/app/Models/Transaction.php index 13b7b05..12df505 100644 --- a/web/app/Models/Transaction.php +++ b/web/app/Models/Transaction.php @@ -69,14 +69,14 @@ class Transaction extends Model 'asset_id' => $asset->id, 'place_id' => $placeId, 'user_id' => $user->id, - 'delta' => $asset->priceInTokens, + 'delta' => -$asset->priceInTokens, 'seller_id' => $asset->creatorId ]; // XlXi: Assets have a 30% tax. return [ self::createPurchase($transaction), - self::createSale(array_merge($transaction, ['delta' => $transaction['delta'] * (1-.3)])) + self::createSale(array_merge($transaction, ['delta' => $transaction['delta'] * -(1-.3)])) ]; } }