Skip to content

Commit

Permalink
Merge pull request #560 from plural/banlist-limbo-ids
Browse files Browse the repository at this point in the history
Add an option for active MWL in get_mwl_info.
  • Loading branch information
plural authored Oct 21, 2021
2 parents 773cf6f + 78a3874 commit 6213157
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AppBundle/Controller/BuilderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function buildformAction(string $side_text, EntityManagerInterface $entit
$identities = $cardsData->select_only_latest_cards($identities);
$banned_cards = array();
foreach ($identities as $id) {
$i = $cardsData->get_mwl_info([$id]);
$i = $cardsData->get_mwl_info([$id], true /* active_only */);
if (count($i) > 0 && $i[array_keys($i)[0]]['active'] && $i[array_keys($i)[0]]['deck_limit'] === 0) {
$banned_cards[$id->getCode()] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppBundle/Controller/FactionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function factionAction(string $faction_code, EntityManagerInterface $enti

$identity = $cardsData->select_only_latest_cards($identities);

$i = $cardsData->get_mwl_info([$identity[0]]);
$i = $cardsData->get_mwl_info([$identity[0]], true /* active_only */);
if (count($i) > 0 && $i[array_keys($i)[0]]['active'] && $i[array_keys($i)[0]]['deck_limit'] === 0) {
$banned_cards[$identity[0]->getCode()] = true;
}
Expand Down
8 changes: 6 additions & 2 deletions src/AppBundle/Service/CardsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,14 @@ function ($s) {
));
}

public function get_mwl_info(array $cards)
public function get_mwl_info(array $cards, bool $active_only = false)
{
$response = [];
$mwls = $this->entityManager->getRepository(Mwl::class)->findBy([], ["dateStart" => "DESC"]);
$filters = [];
if ($active_only) {
$filters = ["active" => 1];
}
$mwls = $this->entityManager->getRepository(Mwl::class)->findBy($filters, ["dateStart" => "DESC"]);

foreach ($cards as $card) {
$card_code = $card->getCode();
Expand Down

0 comments on commit 6213157

Please sign in to comment.