- šµš±Poland Graber
+1 for that, it caused some confusion for me why should I use string data type for a decimal field property..
Also I think worth adding to the DecimalData class comment that float should not be used due to rounding issues.
- šµš±Poland piotr pakulski Poland šŖšŗ
also +1 from me, the patch looks ok. Voting to push this further.
- Status changed to Needs review
over 1 year ago 10:23am 17 May 2023 - last update
over 1 year ago 29,388 pass - šµš±Poland Graber
Ok, here goes then, let's see if testbot is ok with this after so many years.
- Status changed to Needs work
over 1 year ago 10:51am 17 May 2023 - Status changed to Needs review
over 1 year ago 11:28am 17 May 2023 - last update
over 1 year ago 29,388 pass - šµš±Poland Graber
Aaargh, forgot to add before diff --cached ;)
Here goes.
- š§šŖBelgium borisson_ Mechelen, š§šŖ
The comment can be reflowed closer to 80 chars, I know that this is an ubernitpick, but that is the only change needed still, after that I can rtbc this change.
- šµš±Poland Graber
Not sure what you mean, thought we only have a line length limit of 80 according to standards and here the info is split to lines and the first line has a empty line following so my phpcs doesn't complain. Can you please propose a specific change?
- šµš±Poland Graber
Also see ItemList.php in the same folder. What's the difference?
- š§šŖBelgium borisson_ Mechelen, š§šŖ
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/DecimalData.php @@ -0,0 +1,27 @@ + * Because PHP does not have a primitive type decimal and using + * float can result in unexpected rounding behavior, it is
* Because PHP does not have a primitive type decimal and using float can * result in unexpected rounding behavior, it is implemented and displayed * as string.
This is also still < 80 chars and makes it a little bit easier to read. Like I said, super tiny change.
- last update
over 1 year ago 29,387 pass, 2 fail - šµš±Poland Graber
Fingers crossed ;)
I'll stop the test for this one.
- Status changed to RTBC
over 1 year ago 12:59pm 17 May 2023 The last submitted patch, 44: core-2888763-44.patch, failed testing. View results ā
- last update
over 1 year ago 29,388 pass - šµš±Poland Graber
Re-ran and passed. It was quite obvious the fail was not related. Moving back to RTBC.
- last update
over 1 year ago 29,388 pass - last update
over 1 year ago 29,387 pass, 2 fail The last submitted patch, 44: core-2888763-44.patch, failed testing. View results ā
- last update
over 1 year ago 29,380 pass, 4 fail The last submitted patch, 44: core-2888763-44.patch, failed testing. View results ā
- last update
over 1 year ago 29,395 pass - Status changed to Needs work
over 1 year ago 7:04am 25 May 2023 - š«š®Finland lauriii Finland
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php @@ -35,7 +35,7 @@ public static function defaultStorageSettings() { + $properties['value'] = DataDefinition::create('decimal')
At the moment most of the decimal field logic is on the UI layer, i.e.
\Drupal\Core\Field\Plugin\Field\FieldWidget\NumberWidget
. It looks like this issue wants to change this so that\Drupal\Core\Field\Plugin\Field\FieldType\DecimalItem
is storing the data using the decimal data type, allowing us to remove some of the handling from the UI layer.Unfortunately I don't think this is working as it should at the moment because this configures the column with the Mysql default precision and scale. This could lead to really confusing behavior because this would completely bypass the precision and scale configured in field config.
If we are going to move to using the decimal data type in Mysql, the configuration should be moved from field config to field storage. We also need to asses what changes are needed in
\Drupal\Core\Field\Plugin\Field\FieldWidget\NumberWidget
. I think we need to write additional test coverage too because it doesn't look like the current test coverage was able to catch this. - š«š®Finland lauriii Finland
Removing the subsystem maintainer review tag as well because I don't think it's needed anymore.
- šµš±Poland Graber
@lauriii what do you think this test should exactly do? The only thing I see different from the previous logic is that zero will not evaluate to NULL as in case of int currently. Is that it or you have any other ideas so if someone starts working on it, they'll not land at nw again?
- š«š®Finland lauriii Finland
We could use the tests for integer as starting point for decimals and adjust the assertions to what we expect them to be with the new decimal type. This would already cover the
NULL
use case and the other basic use cases š 35:13 34:17 Running- @graber opened merge request.
- Status changed to Needs review
over 1 year ago 11:16am 25 May 2023 20:34 19:15 Running2:06 0:57 Running- šµš±Poland Graber
So now we have double validation and we can remove the field level one. Just one question: should we leave the type one with is_numeric or go for the regex instead? Iād go for is_numeric.
- last update
over 1 year ago 29,397 pass - Status changed to RTBC
over 1 year ago 1:51pm 30 May 2023 - š§šŖBelgium borisson_ Mechelen, š§šŖ
I agree with #60, keeping this is the
is_numeric
is perfectly fine and probably somewhat faster than the regex. Back to rtbc now that we have test coverage. - last update
over 1 year ago 29,401 pass - last update
over 1 year ago 29,402 pass - last update
over 1 year ago 29,411 pass - last update
over 1 year ago 29,416 pass - last update
over 1 year ago 29,434 pass - last update
over 1 year ago 29,437 pass - last update
over 1 year ago 29,437 pass - last update
over 1 year ago 29,445 pass - last update
over 1 year ago 29,450 pass - last update
over 1 year ago 29,499 pass - last update
over 1 year ago 29,499 pass - last update
over 1 year ago 29,508 pass - last update
over 1 year ago 29,553 pass - last update
over 1 year ago 29,553 pass 56:29 55:15 Running- last update
over 1 year ago 29,567 pass - last update
over 1 year ago 29,571 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,802 pass - last update
over 1 year ago 29,804 pass - last update
over 1 year ago 29,811 pass - last update
over 1 year ago 29,814 pass - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,826 pass 10:39 6:54 Running- Status changed to Needs work
over 1 year ago 7:44pm 23 July 2023 - last update
over 1 year ago 29,877 pass - last update
over 1 year ago 29,877 pass - Status changed to Needs review
over 1 year ago 7:18am 24 July 2023 - Status changed to RTBC
over 1 year ago 8:27am 24 July 2023 - š§šŖBelgium borisson_ Mechelen, š§šŖ
Both of the remarks by @lauriii have been resolved.
-
lauriii ā
committed da8c8f98 on 11.x
Issue #2888763 by Graber, skyredwang, borisson_, Wim Leers, tstoeckler,...
-
lauriii ā
committed da8c8f98 on 11.x
- Status changed to Fixed
over 1 year ago 8:52am 24 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.