Skip to content

Commit

Permalink
Weights won't allow for decimal points
Browse files Browse the repository at this point in the history
WIP improvements to status of indicators based on weights
Fixes #633
  • Loading branch information
timlinux committed Nov 22, 2024
1 parent 8760e3e commit 8594408
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
18 changes: 9 additions & 9 deletions geest/core/json_tree_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ def getStatus(self):
# If so, return "Excluded from analysis"
if self.isIndicator():
# Required flag can be overridden by the factor so we dont check it right now
required_by_parent = self.parentItem.attributes().get(
"dimension_weighting", 0.0
required_by_parent = float(
self.parentItem.attributes().get("dimension_weighting", 0.0)
)
required_by_self = data.get("factor_weighting", 0.0)
log_message(
f"{data.get('id')} Required by indicator: {required_by_self} and required by parent: {required_by_parent}"
)
if not int(required_by_parent) or not int(required_by_self):
log_message(f"Excluded from analysis: {data.get('id')}")
required_by_self = float(data.get("factor_weighting", 0.0))
# log_message(
# f"{data.get('id')} Required by indicator: {required_by_self:.10f} and required by parent: {required_by_parent:.10f}"
# )
if not required_by_parent or not required_by_self:
# log_message(f"Excluded from analysis: {data.get('id')}")
return "Excluded from analysis"
if self.isFactor():
if not data.get("required", False):
if not data.get("dimension_weighting", False):
if not float(data.get("dimension_weighting", 0.0)):
return "Excluded from analysis"
if "Error" in data.get("result", ""):
return "Workflow failed"
Expand Down
9 changes: 7 additions & 2 deletions geest/gui/panels/tree_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,8 @@ def _start_workflows(self, parent_item, role=None):
"""
for i in range(parent_item.childCount()):
child_item = parent_item.child(i)
if child_item.getStatus() == "Excluded from analysis":
continue
self.queue_workflow_task(child_item, role)
# Recursively process children (dimensions, factors)
self._start_workflows(child_item, role)
Expand Down Expand Up @@ -921,9 +923,12 @@ def _count_workflows_to_run(self, parent_item=None):
child_item = parent_item.child(i)
self._count_workflows_to_run(child_item)
is_complete = child_item.getStatus() == "Workflow Completed"
if not is_complete:
is_disabled = child_item.getStatus() == "Excluded from analysis"
if is_disabled:
continue
elif not is_complete:
self.items_to_run += 1
if is_complete and not self.run_only_incomplete:
elif is_complete and not self.run_only_incomplete:
self.items_to_run += 1

def queue_workflow_task(self, item, role):
Expand Down

0 comments on commit 8594408

Please sign in to comment.