-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #2359 #2360
Fixes #2359 #2360
Conversation
|
||
//this needs to be done after updating the criteria as dynamic tags might be added to the criteria and would | ||
//render the descriptor map list invalid | ||
var allFormulaUsableDescriptor = allFormulaUsable.ToEntityDescriptorMapList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took me a while to figure this one out. We have some caching going on that was outside of the loop. In my implementation, I decided to add a dynamic tag to exclude specific children only (e.g. the direct children) of the container
//The only way to do this is to add a condition to exclude the children explicitly. We create a random string as tag | ||
//to avoid collision and set it in all DIRECT only children so that they will be excluded | ||
|
||
var uniqueTag = ShortGuid.NewGuid(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tha'ts the gist of the logic. I create a tag, add it to all direct children and modify the criteria of the sum formula to exclude the tag explicitrely. I do not know how to do it otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that in a simulation, all direct children entities will have some dummy tags? hmm
no side effects with this after e.g. update/commit or during comparison of the simulation with BBs or so?
The tags will be also e.g. added to the simulation text report (not a big problem, but strange).
var root = new Container().WithContainerType(ContainerType.Simulation).WithName("root"); | ||
_model.Root = root; | ||
|
||
//creating the following structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PavelBal Please check this out. I think this is what you meant but I am not sure :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is what I meant, lol :D Looks good. @msevestre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of formatting adjustments to make
After looking at the implementation, I'm not sure if it's correct or if I just misunderstand the requirement. So with your example from the issue: should it sum up only the volume of the organs (
@Yuri05 The requirement says same as IN container but excluding the parent container. So it should be in ALL sub containers of the parent recursively no? |
well in fact good question @Yuri05 |
Hmm, I actually meant in ALL CHILDREN. But I didn't think about
I guess we can keep it as "in all children". |
[Observation] | ||
public void should_have_created_an_explicit_formula_that_is_the_sum_of_the_defined_parameters() | ||
{ | ||
var explicitFormula = _sumVolume.Formula.DowncastTo<ExplicitFormula>(); | ||
//volume_1_1 + volume_1_2 but not volume_2_1 and not volume1 | ||
explicitFormula.FormulaString.ShouldBeEqualTo("P_1 + P_2"); | ||
explicitFormula.ObjectPaths.Count().ShouldBeEqualTo(2); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the current implementation only takes the DIRECT children into account?
I'm lost...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum no
//root
// |Container1
// | |Dynamic = sum of all volume in children of Container 1
// | |volume = 4 (this parameter should not be used)
// | |SubContainer1_1
// | | |volume = 1
// | |SubContainer1_2
// | | |volume = 2
// |Container2
// | |SubContainer2_2
// | | |volume = 3 (this parameter should not be used)
the parameter is defined in Container 1
so it takes SubContainer1_1 and SubContainer1_2 but not from the parent parent.
I don't have a two level check here but this is the way it would work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it just happens that the test does nto have SubSubContainers. I can add if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I thought that a diagram would make everything super clear lol.
ok, I think the implementation is correct :) |
If… lol do you see any other way to exclude dynamically? |
not at the moment :) |
Fixes #2359
Description
Implement In Children criteria
Type of change
Please mark relevant options with an
x
in the brackets.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Reviewer checklist
Mark everything that needs to be checked before merging the PR.
This change requires a documentation update
above is selectedScreenshots (if appropriate):
Questions (if appropriate):