Skip to content

Commit

Permalink
reads and saves coordinates in reverse order (logitude, latitude)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbleek committed Aug 28, 2018
1 parent e3646c9 commit 0b18c8e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Solr/Bridge/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Util
static public function convertLocationCoordinates(Location $location)
{
$coordinates = $location->getCoordinates()->getCoordinates();
$coordinate = doubleval($coordinates[0]) . '%' . doubleval($coordinates[1]);
$coordinate = doubleval($coordinates[1]) . '%' . doubleval($coordinates[0]);
$coordinate = strtr($coordinate, [
'%'=>',',
','=>'.'
Expand Down
2 changes: 1 addition & 1 deletion test/SolrTest/Bridge/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testConvertLocationCoordinates()

$coordinates->expects($this->once())
->method('getCoordinates')
->willReturn([0.1,0.2])
->willReturn([0.2,0.1])
;

$this->assertEquals('0.1,0.2',Util::convertLocationCoordinates($location));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testGetDocumentIds()
$locations = new ArrayCollection([$location]);
$job->setLocations($locations);

$this->assertSame([$id, "{$id}-{$coordinate1},{$coordinate2}"], $this->jobFilter->getDocumentIds($job));
$this->assertSame([$id, "{$id}-{$coordinate2},{$coordinate1}"], $this->jobFilter->getDocumentIds($job));
}

/**
Expand Down Expand Up @@ -189,7 +189,7 @@ public function testProcessLocation()
{
$locationText = 'some location';
$coordinatesArray = [1.2,2.1];
$coordinatesConverted = '1.2,2.1';
$coordinatesConverted = '2.1,1.2';
$city = 'some city';
$country = 'some country';
$postalCode = 'some postal code';
Expand Down
2 changes: 1 addition & 1 deletion test/SolrTest/Filter/JobBoardPaginationQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function testCreateQuery()
$location->method('getCoordinates')->willReturn($coordinates);
$coordinates->expects($this->once())
->method('getCoordinates')
->willReturn([1.2,2.1])
->willReturn([2.1,1.2])
;
$publishedSince = new DateTime();

Expand Down

0 comments on commit 0b18c8e

Please sign in to comment.