Loading...
 

Change in condition inside a calculation field (breaks rebuilt index operation and calculation)

Status
Open
Subject
Change in condition inside a calculation field (breaks rebuilt index operation and calculation)
Version
21.x
21.x Regression
Category
  • Usability
  • Regression
Feature
Trackers
Advanced Rating Language / Mathematical calculation tracker field
Resolution status
Partially solved
Submitted by
Bernard Sfez / Tiki Specialist
Lastmod by
Bernard Sfez / Tiki Specialist
Rating
(0)
Related-to
Description

Due to (I guess) change in the calculation field, the if condition or the way the index is rebuilt a previous condition to perform a calculation stopped to work and interfere with the rebuild index operation.

calculation that doesn't work
(if timeworkDateIn (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))


The "if" here was checking if there is a value in the field "timeworkDateIn" to avoid a different error (Divide by zero on "0") that was displayed to the visitor of the site. After I upgrade this Tiki20 to Tiki21 I got an error on rebuild index:

[root@server html]# php console.php i:r --log
[04-03-2020 09:48] Started rebuilding index... logging to file: /tmp/Search_Indexer_mysql_tsaharoniki_tiki21_console.log
Unified search engine: MySQL, version 10.1.44-MariaDB
error: The search index could not be rebuilt.
Variable not found "timeworkDateIn".
.../...
2020-03-04T09:48:36+02:00 INFO (6): addDocument trackeritem 53 {"memoryUsage":"22.3 MiB"}
(where it stopped)


I found a workaround see below, but we should have a way to keep it as is or to better verbose so the admin knows what to do.

Long story

I have a field that calculate time from 2 dates field to set a work clock.
Worker enter when he come to work and when he get out.
The calculation is done on save so data are updated constantly and the user can see results in real time.

Screen Shot 2020 03 04 At 09.37.12

It was working fine on Tiki20.

Since I upgraded to Tiki21 it has stopped to work.
(on the sample a new employee entered 3 row after the Tiki was upgraded)
Screen Shot 2020 03 04 At 09.38.05

@Roberto: I think we have similar case setup as we worked together on some solution for a "Tiki" company :-) but else I can provide playground to help.

Update1

I got an error on rebuild index:

[root@server html]# php console.php i:r --log
[04-03-2020 09:48] Started rebuilding index... logging to file: /tmp/Search_Indexer_mysql_tsaharoniki_tiki21_console.log
Unified search engine: MySQL, version 10.1.44-MariaDB
error: The search index could not be rebuilt.
Variable not found "timeworkDateIn".
.../...
2020-03-04T09:48:36+02:00 INFO (6): addDocument trackeritem 53 {"memoryUsage":"22.3 MiB"}
(where it stopped)


trackeritem 53 is an old work clock item (closed).
The calculation was ok and all field looked ok.
I edited and saved and had the following error:

The search index could not be updated. The site is misconfigured. Contact an administrator.
Variable not found "timeworkDateIn".


The field is here and the permaname is correct:
Screen Shot 2020 03 04 At 09.54.04

Retested on the same Tiki still on version 20 (I kept for test) and there it is working fine.
(calculaltion are made, indexing is ok)

I escalated the bug to upgrade blocker.
If something corrupt a working index or block Tiki from indexing then it just kill the website (IMO).

Update2

Above I see that the operation stopped very early, trackeritem 53 (I have more than 1500 trackeritems).
It stopped because it couldn’t find the field "timeworkDateIn" during a calculation.

I have 2 calculation field that use the same field "timeworkDateIn"
If I keep the first one and remove the second it work:

First calculation
(concat (date (str F) (str-to-time (str +0 day) timeworkDateIn)) (str |) timeworkName)

second calculation that doesn't work
(if timeworkDateIn (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))


I reworked the code starting by the smallest value and up till the complete formula;
From: (sub timeworkDateOut timeworkDateIn)
To: (if (IsEmpty timeworkDateIn) NA (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))


Workaround

Use instead isEmpty to test if a field as a value.
(if (IsEmpty timeworkDateIn) NA (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))

I can rebuild the index, but the error is back and displayed.

Divide by zero on "0"


Note: (if (IsEmpty timeworkDateIn) NA exist) return the expected result so the condition is working.
It is unclear why I got the Divide by zero warning.

Importance
7
Easy to solve?
5
Priority
35
Demonstrate Bug
Please demonstrate your bug on show2.tikiwiki.org
 About show2.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tikiwiki.org instance. To start, simply select a version and click on "Create show2.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 show2.tikiwiki.org.

Version: Create show2.tikiwiki.org instance
Ticket ID
7304
Created
Wednesday 04 March, 2020 07:46:52 GMT-0000
LastModif
Thursday 05 March, 2020 07:04:39 GMT-0000

Attachments

 filenamecreatedhitscommentversionfiletype 
No attachments for this item


Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools