eureka2 / G6K

Generator of calculation simulator (calculator)
MIT License
20 stars 19 forks source link

displayable fields #45

Open houcemL opened 3 years ago

houcemL commented 3 years ago

https://github.com/eureka2/G6K/blob/3fe4dc0488aa12475061f7f74194b2ce00f5ad6a/src/G6K/Controller/BaseController.php#L771

Hello

Refering to the LOC the algorithm consider the step diplayable when at least one field is displayable. What if we have one field displayable = true and another false ? or there is a certainty that if one field is displayable all the others are ?

What if we want to make a pure informatif step with no fields ? i already try to make so all is goog the xml is valid but all what i'v got is a infinit loop testing the result with try it

Ths

eureka2 commented 3 years ago

if no field is displayable, the step is skipped but this does not cause an infinite loop.

infinite loops can be caused when executing business rules. For example: 1) Rule R1 modifies the value of data D1. 2) D1 triggers rule R2 3) R2 modifies the value of D2 4) D2 triggers rule R3 5) R3 modifies the value of D1 6) and hop, we go back to 2)

So check your rules!

houcemL commented 3 years ago

Ths for your reactivity

Actually for my infint loop i have no business rule, no fields or group of field even i have no data, all what i do is defining a step with a section with some text

In the algorithm if we have one field displayable we consider the step it self displayable ...

eureka2 commented 3 years ago

Is your xml confidential? if not can you post it here?

houcemL commented 3 years ago

`<?xml version="1.0" encoding="utf-8"?>

` This is the xml causing infinti loop in our custom version of your work
eureka2 commented 3 years ago

I cannot run your XML because it is malformed

houcemL commented 3 years ago

i just edit my comment deleting all content from CDATA you can add manually some text

houcemL commented 3 years ago

the main idea to reproduce the behavior is to define a simulator with a step with a panel with a bloc of information with a chapter with a section with some text. nothing else. no data no group of fields no fields nor rules.

houcemL commented 3 years ago

i fixed with default value $direction = 1; don't sure if i will have some regressions.

but still don't understand the stepDisplayable meaning https://github.com/eureka2/G6K/blob/3fe4dc0488aa12475061f7f74194b2ce00f5ad6a/src/G6K/Controller/BaseController.php#L522

eureka2 commented 3 years ago

Fixed in release 4.4.8 ! thks fo reporting

houcemL commented 3 years ago

ths this resolve the behavor but still have some idéas, what if we consider a step displayable if all block info displayable or all field displayable ? we will have a while condition like this

} while ($stepDisplayableInfos && $stepDisplayableFields && $istep > 0 && $istep <= $stepCount);

and these two flags are initialized as true in the begening of each step processing

do { $stepDisplayableFields = true; $stepDisplayableInfos = true;