Maintain decimal precision in "Number" column type for 0 inputs [SCI-10202]"

This commit is contained in:
Giga Chubinidze 2024-04-13 01:46:44 +04:00
parent 745c52a158
commit 0c2e279730

View file

@ -4,7 +4,7 @@ module RepositoryDatatable
class RepositoryNumberValueSerializer < RepositoryBaseValueSerializer
def value
decimals = scope[:column].metadata.fetch('decimals', Constants::REPOSITORY_NUMBER_TYPE_DEFAULT_DECIMALS).to_i
value_object.data.round(value_object.data.scale.zero? ? 0 : decimals).to_s
value_object.data.round(decimals).to_s
end
end
end