From 3771c1aa94bfd16cbb394ffbee7affae1ab70cac Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sun, 26 Jan 2025 12:20:38 +0600 Subject: [PATCH] pkp/pkp-lib#1660 fixed issue with recommendation value setting --- .../recommendation/ReviewerRecommendation.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/classes/submission/reviewer/recommendation/ReviewerRecommendation.php b/classes/submission/reviewer/recommendation/ReviewerRecommendation.php index 0dca017df7c..49d3ae89c2c 100644 --- a/classes/submission/reviewer/recommendation/ReviewerRecommendation.php +++ b/classes/submission/reviewer/recommendation/ReviewerRecommendation.php @@ -41,6 +41,8 @@ class ReviewerRecommendation extends Model */ protected $guarded = [ 'recommendation_id', + 'recommendationId', + 'value', ]; /** @@ -122,26 +124,11 @@ public function getMultilingualProps(): array protected function value(): Attribute { return Attribute::make( - set: function (?int $value) { + set: function () { if ($this->getRawOriginal('value')) { return $this->getRawOriginal('value'); } - if ($value) { - $existingRecommendation = static::query() - ->withContextId($this->contextId) - ->where('value', $value) - ->exists(); - - if ($existingRecommendation) { - throw new Exception( - "Given recommendation value : {$value} already exist for given context" - ); - } - - return $value; - } - $lastRecommendationValue = static::query() ->withContextId($this->contextId) ->when(