diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 405692c4..42c83c7a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -800,8 +800,9 @@ namespace VEPROMS.CSLA.Library // formats that have it. if (item.IsExactType("And") || item.IsExactType("Or") || item.IsExactType("ImplicitOr")) level++; - if (parent != null && (parent.IsExactType("And") || parent.IsExactType("Or"))) - level++; + //if (item.ParentAndOr) + // level++; + level += item.ParentAndOrCount; // First substep, this is where it uses the orphan logic from above. if (!item.IsRNOPart && !item.IsHigh && item.MyPrevious == null) @@ -841,7 +842,26 @@ namespace VEPROMS.CSLA.Library } return level; } - + private bool ParentAndOr + { + get + { + ItemInfo parent = ActiveParent as ItemInfo; + if (parent == null) return false; + if (parent.IsExactType("And") || parent.IsExactType("Or")) return true; + return parent.ParentAndOr; + } + } + private int ParentAndOrCount + { + get + { + ItemInfo parent = ActiveParent as ItemInfo; + if (parent == null) return 0; + if (parent.IsExactType("And") || parent.IsExactType("Or")) return 1 + parent.ParentAndOrCount; + return parent.ParentAndOrCount; + } + } /// /// Count all levels, including substeps within RNOs. Ignore RNOs that are to the right of /// the AER, but count those that are below higher level RNOs.