Skip to content

Commit

Permalink
[Legislative] Show only elected deputies and candidates on the map + …
Browse files Browse the repository at this point in the history
…wording
  • Loading branch information
illusionOfParadise committed Nov 14, 2018
1 parent 27ec747 commit e9a0143
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker-compose.override.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ version: "3.2"
# environment:
# - BLACKFIRE_CLIENT_ID
# - BLACKFIRE_CLIENT_TOKEN
# - VIRTUAL_HOST=enmarche.code,test.enmarche.code
# - VIRTUAL_HOST=enmarche.code,test.enmarche.code,legislatives.enmarche.code,m.enmarche.code
# - VIRTUAL_PORT=80

# rabbitmq:
Expand Down
3 changes: 2 additions & 1 deletion src/Api/LegislativeCandidateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AppBundle\Api;

use AppBundle\Entity\LegislativeCandidate;
use AppBundle\Repository\LegislativeCandidateRepository;
use AppBundle\Twig\AssetRuntime;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Expand All @@ -21,7 +22,7 @@ public function __construct(LegislativeCandidateRepository $repository, AssetRun

public function getForApi(): array
{
foreach ($this->repository->findAllForDirectory() as $candidate) {
foreach ($this->repository->findAllForDirectory(LegislativeCandidate::STATUS_WON) as $candidate) {
if (!$candidate->getGeojson()) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataFixtures/ORM/LoadLegislativesData.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function load(ObjectManager $manager)
Genders::MALE,
'Etienne',
'de Monté-Cristo',
null,
file_get_contents(__DIR__.'/../legislatives/geojson-paris-1.json'),
null,
LegislativeCandidate::STATUS_QUALIFIED
));
Expand Down
39 changes: 39 additions & 0 deletions src/DataFixtures/legislatives/geojson-paris-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"type": "Polygon",
"coordinates": [
[
[
2.3257616254697,
48.869546133476
],
[
2.3278733621861,
48.869861088958
],
[
2.3508413205563,
48.863344411573
],
[
2.3500912644194,
48.861951749823
],
[
2.3445592260856,
48.85398930556
],
[
2.3328469000671,
48.859300907461
],
[
2.3207773515807,
48.863075035941
],
[
2.3257616254697,
48.869546133476
]
]
]
}
2 changes: 1 addition & 1 deletion templates/legislatives/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ul class="list__links list__links--row list__links--no-decor list__links--nav">
{% set currentRoute = app.request.attributes.get('_route') %}
{% for route, title in {
'legislatives_map': 'La carte'
'legislatives_map': 'Consulter la carte des député(e)s'
} %}
<li class="{{ route == currentRoute ? 'active' }}">
<a href="{{ path(route) }}">
Expand Down
2 changes: 1 addition & 1 deletion templates/legislatives/map_candidates.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<main class="legislatives__map">
<header class="l__wrapper text--center b__nudge--bottom">
<h1 class="text--large text--pink">
La carte des candidat(e)s <em>La République En Marche !</em>
La carte des député(e)s <em>La République En Marche !</em>
</h1>
</header>

Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/Api/LegislativesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LegislativesControllerTest extends WebTestCase
use ControllerTestTrait;
use ApiControllerTestTrait;

public function testApiApprovedCommittees()
public function testApiWonCandidates()
{
$this->client->request(Request::METHOD_GET, '/api/candidates');

Expand All @@ -28,7 +28,7 @@ public function testApiApprovedCommittees()
$this->assertJson($content);

// Check the payload
$this->assertNotEmpty(\GuzzleHttp\json_decode($content, true));
$this->assertSame(1, \count(\GuzzleHttp\json_decode($content, true)));
$this->assertEachJsonItemContainsKey('id', $content);
$this->assertEachJsonItemContainsKey('name', $content);
$this->assertEachJsonItemContainsKey('district', $content);
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/Api/ReferentsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ReferentsControllerTest extends WebTestCase
use ControllerTestTrait;
use ApiControllerTestTrait;

public function testApiApprovedCommittees()
public function testApiReferents()
{
$this->client->request(Request::METHOD_GET, '/api/referents');

Expand Down

0 comments on commit e9a0143

Please sign in to comment.