Bug 19759 - TestBuilder generates too many decimals for float
Summary: TestBuilder generates too many decimals for float
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-06 16:06 UTC by Jonathan Druart
Modified: 2018-06-04 20:15 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19759: Make TestBuilder generates only 2 decimals for float (1.15 KB, patch)
2017-12-06 16:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19759: Make TestBuilder generates only 2 decimals for float (1.99 KB, patch)
2017-12-06 16:44 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19759: Make TestBuilder generates only 2 decimals for float (2.03 KB, patch)
2017-12-08 21:11 UTC, Dominic Pichette
Details | Diff | Splinter Review
Bug 19759: Make TestBuilder generates only 2 decimals for float (2.34 KB, patch)
2017-12-15 10:58 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19759: Fix failing test in Chargelostitem.t (1.58 KB, patch)
2017-12-18 17:48 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2017-12-06 16:06:56 UTC
For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'
Comment 1 Jonathan Druart 2017-12-06 16:09:28 UTC
Created attachment 69562 [details] [review]
Bug 19759: Make TestBuilder generates only 2 decimals for float

For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'

Test plan:
  prove t/db_dependent/TestBuilder.t
must return green
Comment 2 Jonathan Druart 2017-12-06 16:44:53 UTC
Created attachment 69566 [details] [review]
Bug 19759: Make TestBuilder generates only 2 decimals for float

For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'

Test plan:
  prove t/db_dependent/TestBuilder.t
must return green
Comment 3 Dominic Pichette 2017-12-08 21:11:52 UTC
Created attachment 69666 [details] [review]
Bug 19759: Make TestBuilder generates only 2 decimals for float

For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'

Test plan:
  prove t/db_dependent/TestBuilder.t
must return green

Signed-off-by: Dominic Pichette <dominic@inlibro.com>
Comment 4 Marcel de Rooy 2017-12-15 10:58:10 UTC
Created attachment 69821 [details] [review]
Bug 19759: Make TestBuilder generates only 2 decimals for float

For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'

Test plan:
  prove t/db_dependent/TestBuilder.t
must return green

Signed-off-by: Dominic Pichette <dominic@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Somehow I have the feeling that we should allow more decimals sometimes
and perhaps have a number of decimals parameter or so. Think of fields
like currency or discount.
But the current issues justify this change.
Comment 5 Marcel de Rooy 2017-12-15 10:59:22 UTC
(In reply to Marcel de Rooy from comment #4)
> like currency or discount.

currency rate
Comment 6 Jonathan Druart 2017-12-18 15:19:21 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 7 Jonathan Druart 2017-12-18 17:48:30 UTC
Created attachment 69861 [details] [review]
Bug 19759: Fix failing test in Chargelostitem.t

t/db_dependent/Circulation/Chargelostitem.t .. 1/6
 #   Failed test 'The accountline amount should be precessfee value '
 #   at t/db_dependent/Circulation/Chargelostitem.t line 71.
 #          got: '4.5968041848873e+20'
 #     expected: '459680418488730451968.00'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2017-12-18 17:49:12 UTC
Last patch pushed to master.
Comment 9 Nick Clemens 2017-12-20 13:02:55 UTC
Awesome work all! Pushed to stable for 17.11.01