Commit 0d3db428 authored by Ashley George's avatar Ashley George Committed by Christian Adamski

Issue #2796999 by Ashley George: Proximity contextual filter causes nodes to...

Issue #2796999 by Ashley George: Proximity contextual filter causes nodes to be incorrectly omitted from view
parent 8a2055f1
......@@ -233,14 +233,14 @@ class GeolocationCore {
$filter_lng = deg2rad($filter_lng);
return "(
ACOS(
ACOS(LEAST(1,
$filter_latcos
* $field_latcos
* COS( $filter_lng - $field_lng )
+
$filter_latsin
* $field_latsin
) * $earth_radius
)) * $earth_radius
)";
}
......
......@@ -161,4 +161,27 @@ class GeolocationViewsProximityArgumentTest extends ViewTestBase {
$this->assertText('Proximity 3', 'Proximity 3 element found.');
}
/**
* Tests to ensure rounding error doesn't occur (d.o #2796999).
*/
public function testRoundingError() {
$entity_test_storage = \Drupal::entityTypeManager()->getStorage('node');
$entity_test_storage->create([
'id' => 1,
'title' => 'Proximity 1',
'body' => 'test test',
'type' => 'article',
$this->fieldId => [
'lat' => 51.4545,
'lng' => -2.5879,
],
])->save();
$this->drupalGet($this->viewsPath . '/51.4545,-2.5879<10000miles');
$this->assertResponse(200);
$this->assertText('Proximity 1', 'Proximity 1 element found.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment