Skip to content

Commit 7497be4

Browse files
committed
fuck stan again
1 parent a0b8ac7 commit 7497be4

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

module/FakBundle/Controller/Admin/ScannerController.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,32 @@ public function manageAction()
1414
->getRepository('FakBundle\Entity\Scanner')
1515
->findBy(array(), array('amount' => 'DESC'));
1616

17-
// Set EntityManager for each checkin so getFullName() works
17+
$filteredCheckins = array();
18+
$currentAcademicYear = $this->getCurrentAcademicYear();
19+
1820
foreach ($allCheckins as $checkin) {
1921
$checkin->setEntityManager($this->getEntityManager());
22+
$person = $this->getEntityManager()
23+
->getRepository('CommonBundle\Entity\User\Person')
24+
->findOneByUsername($checkin->getUserName());
25+
26+
// Only filter if person is an Academic
27+
if ($person instanceof \CommonBundle\Entity\User\Person\Academic) {
28+
$unit = $person->getUnit($currentAcademicYear);
29+
if ($unit && strtolower($unit->getName()) === 'fakbar') {
30+
continue; // Skip this checkin
31+
}
32+
}
33+
$filteredCheckins[] = $checkin;
2034
}
2135

2236
$paginator = $this->paginator()->createFromArray(
23-
$allCheckins,
37+
$filteredCheckins,
2438
$this->getParam('page')
2539
);
2640

2741
$totalAmount = 0;
28-
foreach ($allCheckins as $checkin) {
42+
foreach ($filteredCheckins as $checkin) {
2943
$totalAmount += $checkin->getAmount();
3044
}
3145

0 commit comments

Comments
 (0)