Skip to content

Commit

Permalink
Merge pull request #526 from yanokwa/remove-dynamic-default-warning
Browse files Browse the repository at this point in the history
Warning for dynamic defaults now more annoying than helpful
  • Loading branch information
yanokwa authored Mar 26, 2021
2 parents f4c76e7 + a9def04 commit 43ea039
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
6 changes: 1 addition & 5 deletions pyxform/tests_v1/test_dynamic_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,7 @@ def test_dynamic_default_warns(self):
warnings=warnings,
)

self.assertTrue(len(warnings) == 1)
self.assertTrue(
"Not all form filling software and versions support dynamic defaults"
in warnings[0]
)
self.assertTrue(len(warnings) == 0)

def test_default_date_not_considered_dynamic(self):
self.assertPyxformXform(
Expand Down
3 changes: 1 addition & 2 deletions pyxform/tests_v1/test_typed_calculates.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def test_non_calculate_type_with_calculation_and_dynamic_default_warns(self):
warnings=warnings,
)

self.assertTrue(len(warnings) == 1)
self.assertTrue("This form definition contains dynamic defaults" in warnings[0])
self.assertTrue(len(warnings) == 0)

def test_non_calculate_type_with_calculation_and_default_no_warns(self):
warnings = []
Expand Down
13 changes: 0 additions & 13 deletions pyxform/xls2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,6 @@ def workbook_to_json(
# Rows from the survey sheet that should be nested in meta
survey_meta = []

dynamic_default_warning_added = False

# row by row, validate questions, throwing errors and adding warnings
# where needed.
for row in survey_sheet:
Expand Down Expand Up @@ -622,17 +620,6 @@ def workbook_to_json(
question_name = row.get(constants.NAME)

question_default = row.get("default")
if (
default_is_dynamic(question_default, question_type)
and not dynamic_default_warning_added
):
warnings.append(
"This form definition contains dynamic defaults. Not all "
"form filling software and versions support dynamic defaults "
"so you should test the form with the software version you "
"plan to use."
)
dynamic_default_warning_added = True

if not question_type:
# if name and label are also missing,
Expand Down

0 comments on commit 43ea039

Please sign in to comment.