feat: FCP filter counts now respect all active search filters
This commit is contained in:
@@ -1451,13 +1451,14 @@ class PreorderController extends mfBaseController {
|
||||
$fcps = ADBRimoFcp::getAll(["netzgebiet_id" => intval($campaign->network->adb_netzgebiet_id)]) ?? [];
|
||||
if (empty($fcps)) return [];
|
||||
|
||||
$fcpIds = array_map(fn($fcp) => $fcp->id, $fcps);
|
||||
$stats = ADBRimoFcp::getRimoFcpStatistics($fcpIds);
|
||||
$statsMap = [];
|
||||
foreach ($stats as $stat) {
|
||||
$statsMap[$stat['fcp_id']] = $stat['total_active_preorders'];
|
||||
$filter = $this->request->filter ?? [];
|
||||
// We want to count preorders matching ALL other filters, but ignoring the current FCP filter
|
||||
if (isset($filter['fcp'])) {
|
||||
unset($filter['fcp']);
|
||||
}
|
||||
|
||||
$statsMap = PreorderModel::countActiveGroupedByFcp($filter);
|
||||
|
||||
$result = array_map(
|
||||
fn($fcp) => [
|
||||
"real_id" => $fcp->id,
|
||||
|
||||
Reference in New Issue
Block a user