Skip to content

Commit da35f51

Browse files
committed
fix: update form import/export
1 parent 25374cc commit da35f51

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apollo/formsframework/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from xlwt import Workbook
99

1010
from apollo.formsframework.models import Form
11+
from apollo.submissions.qa.query_builder import build_expression
1112
from apollo.utils import generate_identifier
1213

1314
gt_constraint_regex = re.compile(r'(?:.*\.\s*\>={0,1}\s*)(\d+)')
@@ -183,6 +184,10 @@ def _process_qa_worksheet(qa_data):
183184
if 'name' in qa_dict:
184185
if current_name != qa_dict['name']:
185186
if current_check is not None:
187+
if 'expression' not in current_check:
188+
current_check.update(
189+
expression=build_expression(current_check))
190+
current_check.pop('criteria', None)
186191
quality_checks.append(current_check)
187192
current_name = qa_dict['name']
188193
current_check = {
@@ -211,9 +216,15 @@ def _process_qa_worksheet(qa_data):
211216
'comparator': qa_dict['relation'],
212217
'rvalue': qa_dict['right']
213218
}
219+
qa_check.update(expression=build_expression(qa_check))
220+
qa_check.pop('comparator')
221+
qa_check.pop('lvalue')
222+
qa_check.pop('rvalue')
214223
quality_checks.append(qa_check)
215224

216225
if current_check is not None:
226+
current_check.update(expression=build_expression(current_check))
227+
current_check.pop('criteria', None)
217228
quality_checks.append(current_check)
218229

219230
return quality_checks

0 commit comments

Comments
 (0)