tricc-oo 1.6.25__py3-none-any.whl → 1.6.26__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tricc_oo/visitors/tricc.py +7 -31
- {tricc_oo-1.6.25.dist-info → tricc_oo-1.6.26.dist-info}/METADATA +1 -1
- {tricc_oo-1.6.25.dist-info → tricc_oo-1.6.26.dist-info}/RECORD +6 -6
- {tricc_oo-1.6.25.dist-info → tricc_oo-1.6.26.dist-info}/WHEEL +0 -0
- {tricc_oo-1.6.25.dist-info → tricc_oo-1.6.26.dist-info}/licenses/LICENSE +0 -0
- {tricc_oo-1.6.25.dist-info → tricc_oo-1.6.26.dist-info}/top_level.txt +0 -0
tricc_oo/visitors/tricc.py
CHANGED
|
@@ -176,7 +176,7 @@ def get_version_inheritance(node, all_prev_versions, processed_nodes):
|
|
|
176
176
|
expression = node.expression or node.expression_reference or getattr(node, "relevance", None)
|
|
177
177
|
# Merge with ALL previous versions, not just the last one
|
|
178
178
|
if all_prev_versions:
|
|
179
|
-
expression =
|
|
179
|
+
expression = merge_expressions(expression, *all_prev_versions)
|
|
180
180
|
if node.expression:
|
|
181
181
|
node.expression = expression
|
|
182
182
|
elif node.expression_reference:
|
|
@@ -216,39 +216,15 @@ def get_version_inheritance(node, all_prev_versions, processed_nodes):
|
|
|
216
216
|
node.expression = TriccOperation(TriccOperator.COALESCE, coalesce_operands)
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
def
|
|
219
|
+
def merge_expressions(expression, last_version, *argv):
|
|
220
220
|
datatype = expression.get_datatype()
|
|
221
221
|
if datatype == "boolean":
|
|
222
|
-
expression = or_join([TriccOperation(TriccOperator.ISTRUE, [last_version]), expression])
|
|
222
|
+
expression = or_join([TriccOperation(TriccOperator.ISTRUE, [last_version, *argv]), expression])
|
|
223
223
|
|
|
224
224
|
elif datatype == "number":
|
|
225
|
-
expression = TriccOperation(TriccOperator.PLUS, [last_version, expression])
|
|
225
|
+
expression = TriccOperation(TriccOperator.PLUS, [last_version, *argv, expression])
|
|
226
226
|
else:
|
|
227
|
-
expression = TriccOperation(TriccOperator.COALESCE, [last_version,
|
|
228
|
-
return expression
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
def merge_all_expressions(expression, all_versions):
|
|
232
|
-
"""
|
|
233
|
-
Merge an expression with ALL previous versions, not just the last one.
|
|
234
|
-
This ensures inheritance works even when intermediate versions weren't evaluated
|
|
235
|
-
due to activity relevance conditions.
|
|
236
|
-
"""
|
|
237
|
-
if not all_versions:
|
|
238
|
-
return expression
|
|
239
|
-
|
|
240
|
-
datatype = expression.get_datatype() if expression else "unknown"
|
|
241
|
-
|
|
242
|
-
if datatype == "boolean":
|
|
243
|
-
expression = or_join([expression, *all_versions])
|
|
244
|
-
|
|
245
|
-
else:
|
|
246
|
-
# COALESCE through all previous versions, then the current expression
|
|
247
|
-
coalesce_operands = list(all_versions)
|
|
248
|
-
if expression:
|
|
249
|
-
coalesce_operands.append(expression)
|
|
250
|
-
expression = TriccOperation(TriccOperator.COALESCE, coalesce_operands)
|
|
251
|
-
|
|
227
|
+
expression = TriccOperation(TriccOperator.COALESCE, [expression, last_version, *argv])
|
|
252
228
|
return expression
|
|
253
229
|
|
|
254
230
|
|
|
@@ -582,7 +558,7 @@ def generate_calculates(node, calculates, used_calculates, processed_nodes, proc
|
|
|
582
558
|
node.activity.calculates.append(calc_node)
|
|
583
559
|
last_version = set_last_version_false(calc_node, processed_nodes)
|
|
584
560
|
if last_version:
|
|
585
|
-
calc_node.expression =
|
|
561
|
+
calc_node.expression = merge_expressions(calc_node.expression, last_version)
|
|
586
562
|
processed_nodes.add(calc_node)
|
|
587
563
|
logger.debug(
|
|
588
564
|
"generate_save_calculate:{}:{} as {}".format(
|
|
@@ -615,7 +591,7 @@ def generate_calculates(node, calculates, used_calculates, processed_nodes, proc
|
|
|
615
591
|
node.activity.calculates.append(calc_node)
|
|
616
592
|
last_version = set_last_version_false(calc_node, processed_nodes)
|
|
617
593
|
if last_version:
|
|
618
|
-
calc_node.expression =
|
|
594
|
+
calc_node.expression = merge_expressions(calc_node.expression, last_version)
|
|
619
595
|
processed_nodes.add(calc_node)
|
|
620
596
|
list_calc.append(calc_node)
|
|
621
597
|
node.activity.nodes[calc_node.id] = calc_node
|
|
@@ -41,11 +41,11 @@ tricc_oo/strategies/output/xlsform_cdss.py,sha256=X00Lt5MzV8TX14dR4dFI1MqllI5S1e
|
|
|
41
41
|
tricc_oo/strategies/output/xlsform_cht.py,sha256=66sTRqVL9ZUL8NpX2f0xCRQ-siUKcKphosR9y7wsbuM,28326
|
|
42
42
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=xm6SKirV3nMZvM2w54_zJcXAeAgAkq-EEqGEjnOWv6c,988
|
|
43
43
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
44
|
+
tricc_oo/visitors/tricc.py,sha256=wVCEvvwQ8SQE43MkEqz3qOKkUn9wG6mueUkQn3Q45LM,113490
|
|
45
45
|
tricc_oo/visitors/utils.py,sha256=j83aAq5s5atXi3OC0jc_uJd54a8XrHHmizeeEbWZQJg,421
|
|
46
46
|
tricc_oo/visitors/xform_pd.py,sha256=ryAnI3V9x3eTmJ2LNsUZfvl0_yfCqo6oBgeSu-WPqaE,9613
|
|
47
|
-
tricc_oo-1.6.
|
|
48
|
-
tricc_oo-1.6.
|
|
49
|
-
tricc_oo-1.6.
|
|
50
|
-
tricc_oo-1.6.
|
|
51
|
-
tricc_oo-1.6.
|
|
47
|
+
tricc_oo-1.6.26.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
48
|
+
tricc_oo-1.6.26.dist-info/METADATA,sha256=n-4ymif12lOBLJX6sELWl498w2LfVJTI48_f11f-cak,8600
|
|
49
|
+
tricc_oo-1.6.26.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
50
|
+
tricc_oo-1.6.26.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
51
|
+
tricc_oo-1.6.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|