Skip to content

Commit 36c988c

Browse files
committed
fix ticket-1014
1 parent 72d0404 commit 36c988c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/Module/Tick/History/Component/IonStormMapGeneration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private function generateIonStormMapForLayer(Layer $layer, string $historyFolder
7070
}
7171
imagefill($img, 0, 0, $fillColor);
7272

73-
foreach ($this->anomalyRepository->getLocationsWithIonstormAnomalies() as $location) {
73+
foreach ($this->anomalyRepository->getLocationsWithIonstormAnomalies($layer) as $location) {
7474
$curx = ($location->getCx() - 1) * 2;
7575
$cury = ($location->getCy() - 1) * 2;
7676

src/Orm/Repository/AnomalyRepository.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Stu\Component\Anomaly\Type\AnomalyTypeEnum;
1010
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
1111
use Stu\Orm\Entity\Anomaly;
12+
use Stu\Orm\Entity\Layer;
1213
use Stu\Orm\Entity\Location;
1314
use Stu\Orm\Entity\Map;
1415

@@ -141,20 +142,24 @@ public function getClosestAnomalyDistance(SpacecraftWrapperInterface $wrapper):
141142
}
142143

143144
#[\Override]
144-
public function getLocationsWithIonstormAnomalies(): array
145+
public function getLocationsWithIonstormAnomalies(Layer $layer): array
145146
{
146147
return $this->getEntityManager()
147148
->createQuery(
148149
sprintf(
149-
'SELECT l FROM %s a
150+
'SELECT l FROM %s a
150151
JOIN %s l
151152
WITH a.location = l
152-
WHERE a.anomaly_type_id = :type',
153+
WHERE a.anomaly_type_id = :type
154+
AND l.layer = :layer',
153155
Anomaly::class,
154156
Location::class
155157
)
156158
)
157-
->setParameter('type', AnomalyTypeEnum::ION_STORM->value)
159+
->setParameters([
160+
'type' => AnomalyTypeEnum::ION_STORM->value,
161+
'layer' => $layer->getId()
162+
])
158163
->getResult();
159164
}
160165
}

src/Orm/Repository/AnomalyRepositoryInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Stu\Component\Anomaly\Type\AnomalyTypeEnum;
77
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
88
use Stu\Orm\Entity\Anomaly;
9+
use Stu\Orm\Entity\Layer;
910
use Stu\Orm\Entity\Location;
1011

1112
/**
@@ -36,5 +37,5 @@ public function getClosestAnomalyDistance(SpacecraftWrapperInterface $wrapper):
3637
*
3738
* @return array<Location>
3839
*/
39-
public function getLocationsWithIonstormAnomalies(): array;
40+
public function getLocationsWithIonstormAnomalies(Layer $layer): array;
4041
}

0 commit comments

Comments
 (0)