When using a mathematical field I created several times in the past a field to calculate the age of someone using:
(round (div (sub (date) childrenBirthDate) 31536000 ) 1)
In Tiki 20.1 (from Git; no revision number found) it thrown an error:
Divide by zero on "0"
(sub (date) childrenBirthDate)
is not throwing the error.
The error is coming from a test at "lib/core/Math/Formula/Function/Div.php".
Updated 04/04/2020
After upgrading to Tiki21 the workaround is not useable anymore.
It forbid the index rebuilt operation to complete and therefore the Tiki is broken.
See: https://dev.tiki.org/item7304-Change-in-condition-inside-a-calculation-field-breaks-rebuilt-index-operation-and-calculation
Update 20/05/2020
Found the culprit ! (and it is not directly related to calculation ?)
I have in this tracker an item list field that get info from another tracker so I need to use trackerrender to display the original value and not the value of the dropdown item.
It is not used for any calculation, it is the employee ID
To display it I use:
{FORMAT(name="id")}{display name="tracker_field_timeworkEmployeeId" format="trackerrender" default=""}{FORMAT}
Used that way I got the error:
Divide by zero on "0"
If I change the format for:
{FORMAT(name="id")}{display name="tracker_field_timeworkEmployeeId_text" default=""}{FORMAT}
The error is gone.
Seems fixed under Tiki22.
May be a backport ?
Do you have relation fields in the same tracker? Or pointing to it? Seems that it tries to run the same formula on other trackers without the references field i think when it's trying to do tracker_refresh_itemslist_detail
but i got lost trying to debug it... (hence adding Victor to this wish)
The workaround I did was to add an if
around it (which I think is good practice anyway), e.g.
(if childrenBirthDate (round (div (sub (date) childrenBirthDate) 31536000 ) 1))
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show.tikiwiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |