Skip to content
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

Final logic to allow disabling / enabling any part of the analysis #644

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions geest/core/json_tree_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,20 @@ def getStatus(self):
if not required_by_parent or not required_by_self:
# log_message(f"Excluded from analysis: {data.get('id')}")
return "Excluded from analysis"
#
# Note we avoid infinite recursion by NOT doing the checks below using the getStatus
# method of the parent.
#
# if the parents dimension weighting is zero, return "Excluded from analysis"
if not float(self.parentItem.attribute("dimension_weighting", 0.0)):
return "Excluded from analysis"
# if the grand parent's analysis weighting is zero, return "Excluded from analysis"
if not float(
self.parentItem.parentItem.attribute("analysis_weighting", 0.0)
):
return "Excluded from analysis"
if self.isFactor():
# If the dimension weighting is zero, return "Excluded from analysis"
if not float(data.get("dimension_weighting", 0.0)):
return "Excluded from analysis"
# If the sum of the indicator weightings is zero, return "Excluded from analysis"
Expand All @@ -258,6 +271,13 @@ def getStatus(self):
weight_sum += float(child.attribute("factor_weighting", 0.0))
if not weight_sum:
return "Excluded from analysis"
#
# Note we avoid infinite recursion by NOT doing the checks below using the getStatus
# method of the parent.
#
# if the parent's analysis weighting is zero, return "Excluded from analysis"
if not float(self.parentItem.attribute("analysis_weighting", 0.0)):
return "Excluded from analysis"
if self.isDimension():
# If the analysis weighting is zero, return "Excluded from analysis"
if not float(data.get("analysis_weighting", 0.0)):
Expand Down
Loading