Skip to content

Commit 5e74907

Browse files
author
catch
committed
Issue #2735997 by ramil g, joelpittet, ranjith_kumar_k_u, asad_ahmed, nikita_tt, mschudders, Ben Greenberg, lendude, playful: Decimal separator and decimals settings ignored when aggregating decimal fields
1 parent 5f5f527 commit 5e74907

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

modules/views/src/Plugin/views/query/Sql.php

-7
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,6 @@ public function getAggregationInfo() {
17901790
'method' => 'aggregationMethodSimple',
17911791
'handler' => [
17921792
'argument' => 'groupby_numeric',
1793-
'field' => 'numeric',
17941793
'filter' => 'groupby_numeric',
17951794
'sort' => 'groupby_numeric',
17961795
],
@@ -1800,7 +1799,6 @@ public function getAggregationInfo() {
18001799
'method' => 'aggregationMethodDistinct',
18011800
'handler' => [
18021801
'argument' => 'groupby_numeric',
1803-
'field' => 'numeric',
18041802
'filter' => 'groupby_numeric',
18051803
'sort' => 'groupby_numeric',
18061804
],
@@ -1810,7 +1808,6 @@ public function getAggregationInfo() {
18101808
'method' => 'aggregationMethodSimple',
18111809
'handler' => [
18121810
'argument' => 'groupby_numeric',
1813-
'field' => 'numeric',
18141811
'filter' => 'groupby_numeric',
18151812
'sort' => 'groupby_numeric',
18161813
],
@@ -1820,7 +1817,6 @@ public function getAggregationInfo() {
18201817
'method' => 'aggregationMethodSimple',
18211818
'handler' => [
18221819
'argument' => 'groupby_numeric',
1823-
'field' => 'numeric',
18241820
'filter' => 'groupby_numeric',
18251821
'sort' => 'groupby_numeric',
18261822
],
@@ -1830,7 +1826,6 @@ public function getAggregationInfo() {
18301826
'method' => 'aggregationMethodSimple',
18311827
'handler' => [
18321828
'argument' => 'groupby_numeric',
1833-
'field' => 'numeric',
18341829
'filter' => 'groupby_numeric',
18351830
'sort' => 'groupby_numeric',
18361831
],
@@ -1840,7 +1835,6 @@ public function getAggregationInfo() {
18401835
'method' => 'aggregationMethodSimple',
18411836
'handler' => [
18421837
'argument' => 'groupby_numeric',
1843-
'field' => 'numeric',
18441838
'filter' => 'groupby_numeric',
18451839
'sort' => 'groupby_numeric',
18461840
],
@@ -1850,7 +1844,6 @@ public function getAggregationInfo() {
18501844
'method' => 'aggregationMethodSimple',
18511845
'handler' => [
18521846
'argument' => 'groupby_numeric',
1853-
'field' => 'numeric',
18541847
'filter' => 'groupby_numeric',
18551848
'sort' => 'groupby_numeric',
18561849
],

modules/views_ui/tests/src/Functional/FieldUITest.php

+30-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ class FieldUITest extends UITestBase {
2525
*
2626
* @var array
2727
*/
28-
public static $testViews = ['test_view'];
28+
public static $testViews = [
29+
'test_view',
30+
'test_aggregate_count',
31+
];
32+
33+
/**
34+
* {@inheritdoc}
35+
*/
36+
protected static $modules = [
37+
'entity_test',
38+
];
2939

3040
/**
3141
* Tests the UI of field handlers.
@@ -104,4 +114,23 @@ public function testFieldLabel(): void {
104114
$this->assertEquals('', $view->field['title']->options['label'], 'The field label for normal styles are empty.');
105115
}
106116

117+
/**
118+
* Tests the UI of field aggregation settings.
119+
*/
120+
public function testFieldAggregationSettings(): void {
121+
$edit_handler_url = 'admin/structure/views/nojs/handler-group/test_aggregate_count/default/field/id';
122+
$this->drupalGet($edit_handler_url);
123+
$this->submitForm(['options[group_type]' => 'count'], 'Apply');
124+
$this->assertSession()
125+
->pageTextNotContains('The website encountered an unexpected error. Try again later.');
126+
$this->drupalGet($edit_handler_url);
127+
$dropdown = $this->getSession()->getPage()->find('named', ['select', 'options[group_column]']);
128+
// Ensure the dropdown for group column exists.
129+
$this->assertNotNull($dropdown, 'The dropdown for options[group_column] does not exist.');
130+
$this->submitForm(['options[group_type]' => 'count'], 'Apply');
131+
// Ensure that there is no error after submitting the form.
132+
$this->assertSession()
133+
->pageTextNotContains('The website encountered an unexpected error. Try again later.');
134+
}
135+
107136
}

0 commit comments

Comments
 (0)