Merge pull request #3215 from vismay-golwala/survey_allow_empty_defaults

Allow empty default values for numerical survey answers.

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-03-21 16:37:02 +00:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@@ -2530,7 +2530,7 @@ class JobTemplateSurveySpec(GenericAPIView):
).format(
allowed_types=', '.join(JobTemplateSurveySpec.ALLOWED_TYPES.keys()), **context
)))
if 'default' in survey_item:
if 'default' in survey_item and survey_item['default'] != '':
if not isinstance(survey_item['default'], JobTemplateSurveySpec.ALLOWED_TYPES[qtype]):
type_label = 'string'
if qtype in ['integer', 'float']: