View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
15532 | Feature requests | Survey editing | public | 2019-11-05 11:38 | 2020-01-07 15:40 |
Reporter | ollehar | Assigned To | DenisChenu | ||
Priority | none | Severity | feature | ||
Status | closed | Resolution | fixed | ||
Summary | 15532: Show warnings when implicit alphabetical compare is used in expressions | ||||
Description | EM has no warning system. If an error is reported, the expression stops execution. We need warnings for alphabetical compare, which can be used by mistake by survey designers when they actually want numerical compare. Problem: "2" < "18" is evaluated differently in PHP and JS. This feature will NOT fix evaluation, but instead show warnings when compare is used on strings. Scenarios:
Should also work in the same way for subquestion relevance equations. All scenarios above should also happen with "A10" or "qwerty" strings. It doesn't have to be a number inside the string. The manual entry should recommend users to use strcmp when comparing strings alphabetically, and to use intval/floatval with <, >, <=, >= when comparing numbers numerically. The delivery should include functional and unit tests of the scenarios above. Delivery should be done as a pull request on github. | ||||
Tags | No tags attached. | ||||
Bug heat | 10 | ||||
Story point estimate | |||||
Users affected % | |||||
related to | 15501 | closed | ollehar | Bug reports | relevanceStatus : different evaluation in JS and PHP |
parent of | 15564 | closed | DenisChenu | Bug reports | Warnings shown for valid comparaison |
related to | 15545 | acknowledged | Bug reports | Survey logic file show valid question even if not valid | |
related to | 15547 | new | Bug reports | Invalid error count on Survey Logic file for subquestion relevance |
Only for comparison ? |
|
Warning on operators <, >, <= and >= where at least one argument is a string. If both are numbers (e.g. by using intval before), there is no warning. |
|
OK, then |
|
Yeah, sounds right. +1 |
|
Arg … Q00_SQ001.NAOK >= 2 : OK find WORD and NUMBER |
|
Hm, shouldn't you send us an offer before you start? |
|
Too hard for me … Don't find where i get the result of a function (NUMBER or not) gloups … |
|
I always check if i was able to do it in XX hour before starting :). Here : clearly : need more than one day … and maybe more than one week (rewriting EM). |
|
I hoped it would be enough to add code in https://github.com/LimeSurvey/LimeSurvey/blob/0b7ba655618bbea80dcc72294fb6dc8fcadf47e5/application/helpers/expressions/em_core_helper.php#L309? |
|
Then check $bBothString |
|
No : it need to be in public function GetPrettyPrintString() RDP_EvaluateBinary is only top do the final PHP part Adding a warning for '[0-9 ]' is really more easy … i make a pull request (free one) |
|
Maybe i have something , you're right : RDP_EvaluateBinary we ca,n create a new warnings array. Tomorrow :) |
|
+1 |
|
GetPrettyPrintString will collect warnings, but warnings are created in RDP_EvalBinary, same way as with the errors BUT does not halt execution. Also, warnings shown in yellow, not red. Etc etc. |
|
Yes, I think i work on such system, tomorrow, can send pull request Friday. |
|
… no link in title … |
|
No link to where in which title? |
|
Since the warning is added here : https://github.com/LimeSurvey/LimeSurvey/blob/0b7ba655618bbea80dcc72294fb6dc8fcadf47e5/application/helpers/expressions/em_core_helper.php#L1333 Can check to add a link inside the tooltip but … hard to click … Only solution : rewrite ShowSurveyLogicFile. But its start to make a lot of update for a single warning … |
|
OK, so maybe like this: A warning is an object, class EMWarning. Subclass warning into CompareEMWarning. If $em->warnings[] contains any CompareEMWarning, then add admin flash message about compare with link to manual. E.g. like $bHaveError, could be $bHaveCompareWarning = true, then bla bla bla: https://github.com/LimeSurvey/LimeSurvey/blob/0b7ba655618bbea80dcc72294fb6dc8fcadf47e5/application/helpers/expressions/em_core_helper.php#L1306 |
|
8-| A flash even if the user WANT this compare ???? My opinion SurveyLogicFile is the best (except warning css in core admin theme is awfull …) |
|
A flash in survey logic file check, I mean. |
|
I think of adding a line "wrning : blah blah" on question part … I push 1st part in some minutes |
|
Warnings should be visible on every faulty equation like errors, I think. For flash: Definitely only one! |
|
Maybe best solution : https://github.com/LimeSurvey/LimeSurvey/pull/1341 But have the animation is not the best … I added a warning with + https://github.com/LimeSurvey/LimeSurvey/pull/1341/commits/b7cd1c43c330c6211164c6a23e7248e4489c2d8c |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=29222 |
|
Fixed in Release 3.20.0+191112 |
|
LimeSurvey: master f9a62f8d 2019-11-11 11:53 Committer: ollehar Details Diff |
[READY] Fixed issue 15532: Show warnings when implicit alphabetical compare (#1341) Fixed issue 15532: Show warnings when implicit alphabetical compare is used in expressions |
Affected Issues 15532 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
mod - application/helpers/viewHelper.php | Diff File | ||
mod - assets/styles-public/expressions.css | Diff File | ||
add - tests/controllers/ExpressionWarningsOnLogicTest.php | Diff File | ||
add - tests/data/surveys/limesurvey_survey_SurveyLogicWarnings.lss | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-11-05 11:38 | ollehar | New Issue | |
2019-11-05 11:48 | ollehar | Description Updated | |
2019-11-05 11:49 | ollehar | Description Updated | |
2019-11-05 11:49 | ollehar | Description Updated | |
2019-11-05 11:49 | ollehar | Description Updated | |
2019-11-05 11:54 | ollehar | Description Updated | |
2019-11-05 11:55 | ollehar | Description Updated | |
2019-11-05 11:58 | ollehar | Summary | Show warnings when alphabetical compare is used in expressions => Show warnings when implicit alphabetical compare is used in expressions |
2019-11-05 11:59 | ollehar | Description Updated | |
2019-11-05 12:07 | ollehar | Description Updated | |
2019-11-05 13:00 | ollehar | Description Updated | |
2019-11-05 13:04 | DenisChenu | Note Added: 54397 | |
2019-11-05 13:08 | ollehar | Note Added: 54398 | |
2019-11-05 14:04 | DenisChenu | Note Added: 54399 | |
2019-11-05 14:04 | DenisChenu | Note Edited: 54399 | |
2019-11-05 14:04 | ollehar | Note Added: 54400 | |
2019-11-06 16:22 | DenisChenu | Issue Monitored: DenisChenu | |
2019-11-06 16:32 | DenisChenu | Note Added: 54434 | |
2019-11-06 16:33 | ollehar | Note Added: 54435 | |
2019-11-06 16:38 | DenisChenu | Note Added: 54436 | |
2019-11-06 16:40 | DenisChenu | Note Added: 54437 | |
2019-11-06 16:43 | ollehar | Note Added: 54439 | |
2019-11-06 16:44 | ollehar | Note Added: 54440 | |
2019-11-06 17:06 | DenisChenu | Note Added: 54443 | |
2019-11-06 17:31 | DenisChenu | Note Added: 54446 | |
2019-11-06 17:37 | ollehar | Note Added: 54448 | |
2019-11-06 17:38 | ollehar | Note Added: 54449 | |
2019-11-06 18:06 | DenisChenu | Note Added: 54450 | |
2019-11-06 18:22 | DenisChenu | Note Added: 54451 | |
2019-11-07 10:15 | ollehar | Note Added: 54456 | |
2019-11-07 10:28 | DenisChenu | Note Added: 54457 | |
2019-11-07 11:45 | ollehar | Note Added: 54459 | |
2019-11-07 11:56 | DenisChenu | Note Added: 54460 | |
2019-11-07 13:09 | ollehar | Note Added: 54462 | |
2019-11-07 16:06 | DenisChenu | Assigned To | => DenisChenu |
2019-11-07 16:06 | DenisChenu | Status | new => assigned |
2019-11-07 16:07 | DenisChenu | Note Added: 54468 | |
2019-11-07 17:03 | ollehar | Note Added: 54470 | |
2019-11-07 17:55 | DenisChenu | Note Added: 54471 | |
2019-11-07 18:05 | DenisChenu | Relationship added | related to 15545 |
2019-11-08 08:05 | DenisChenu | Relationship added | related to 15547 |
2019-11-08 15:54 | DenisChenu | Relationship added | related to 15501 |
2019-11-08 15:59 | DenisChenu | Assigned To | DenisChenu => ollehar |
2019-11-08 15:59 | DenisChenu | Status | assigned => ready for testing |
2019-11-08 15:59 | DenisChenu | Note Added: 54486 | |
2019-11-11 10:53 | ollehar | Changeset attached | => LimeSurvey master f9a62f8d |
2019-11-11 10:53 | DenisChenu | Note Added: 54497 | |
2019-11-11 10:53 | DenisChenu | Assigned To | ollehar => DenisChenu |
2019-11-11 10:53 | DenisChenu | Resolution | open => fixed |
2019-11-11 14:55 | lime_release_bot | Note Added: 54518 | |
2019-11-11 14:55 | lime_release_bot | Status | ready for testing => closed |
2019-11-14 17:34 | DenisChenu | Relationship added | parent of 15564 |
2020-01-07 15:40 | jelo | Issue Monitored: jelo | |
2021-08-02 17:37 | guest | Bug heat | 6 => 10 |