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

Warning for dynamic defaults now more annoying than helpful #526

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
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
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