Skip to content

Commit

Permalink
fix: add selection plan is not null condition for actions filter
Browse files Browse the repository at this point in the history
Change-Id: Ib54b7c61496929a68083345ff75d994541dd1510
  • Loading branch information
smarcet committed Feb 13, 2024
1 parent a020884 commit 66386e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Repositories/Summit/DoctrineSummitEventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Ord

if (!is_null($filter)) {
$filter->apply2Query($query, $this->getCustomFilterMappings($current_member_id, $current_track_id));
if($filter->hasFilter('actions')){
// if actions filter is required, we should do an inner join with the allowed
// actions of the selection plan of the presentation
$query = $query->innerJoin("p.selection_plan","sp_i")
->innerJoin("sp_i.allowed_presentation_action_types","allowed_at")
->innerJoin("allowed_at.type","allowed_at_type")
->andWhere("allowed_at_type = at");
}
}

$shouldPerformRandomOrderingByPage = false;
Expand Down
4 changes: 4 additions & 0 deletions tests/FilterParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public function testApplyFilterAND()
)
]);

$query->innerJoin("p.selection_plan","sp");
$query->innerJoin("sp.allowed_presentation_action_types","allowed_at");
$query->innerJoin("allowed_at.type","allowed_at_type", Join::ON, "allowed_at_type.id = at.id");

$dql = $query->getDQL();
$this->assertTrue(!empty($dql));
}
Expand Down

0 comments on commit 66386e8

Please sign in to comment.