Skip to content

Commit

Permalink
#1660 fixed filtering to use context id
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Jan 26, 2025
1 parent 5b14b26 commit 15db26a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions classes/submission/reviewAssignment/ReviewAssignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,8 @@ public static function getReviewerRecommendationOptions(
->when(
$reviewAssignment,
fn ($query) => $query->orWhere(
fn ($query) => $query->withRecommendation(
$reviewAssignment->getData("recommendation")
fn ($query) => $query->withRecommendations(
[$reviewAssignment->getData("recommendation")]
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ protected function removable(): Attribute
return Attribute::make(
get: fn () => !Repo::reviewAssignment()
->getCollector()
->filterByContextIds([$this->contextId])
->filterByRecommenddations([$this->value])
->getQueryBuilder()
->exists()
Expand All @@ -188,7 +189,8 @@ protected function reviewAssignments(): Attribute
return Attribute::make(
get: fn () => Repo::reviewAssignment()
->getCollector()
->filterByRecommenddations([$this->id])
->filterByContextIds([$this->contextId])
->filterByRecommenddations([$this->value])
->getMany()
)->shouldCache();
}
Expand All @@ -212,8 +214,8 @@ public function scopeWithActive(Builder $query, bool $active = true): Builder
/**
* Scope a query to filter by recommendation value
*/
public function scopeWithRecommendation(Builder $query, int $recommendation): Builder
public function scopeWithRecommendations(Builder $query, array $recommendations): Builder
{
return $query->where('value', $recommendation);
return $query->whereIn('value', $recommendations);
}
}

0 comments on commit 15db26a

Please sign in to comment.