Fix pattern generation
This commit is contained in:
+6
-6
@@ -119,18 +119,18 @@ class SignupForm(models.Model):
|
||||
}
|
||||
elif question_type == "radiobutton":
|
||||
options = q["options"]
|
||||
pattern = ""
|
||||
map(lambda x: pattern.join(f"^{x}$|"), options)
|
||||
regexes = map(lambda x: f"^{x}$", options)
|
||||
pattern = "|".join(regexes)
|
||||
properties[id] = {
|
||||
"type": "string",
|
||||
# Remove last regex or
|
||||
"pattern": pattern[:-1],
|
||||
"pattern": pattern,
|
||||
|
||||
}
|
||||
elif question_type == "checkbox":
|
||||
options = q["options"]
|
||||
pattern = ""
|
||||
map(lambda x: pattern.join(f"^{x}$|"), options)
|
||||
regexes = map(lambda x: f"^{x}$", options)
|
||||
pattern = "|".join(regexes)
|
||||
|
||||
properties[id] = {
|
||||
"type": "array",
|
||||
@@ -138,7 +138,7 @@ class SignupForm(models.Model):
|
||||
"maxItems": len(options),
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": pattern[:-1]
|
||||
"pattern": pattern
|
||||
}
|
||||
}
|
||||
else: raise Exception("invalid question type!")
|
||||
|
||||
Reference in New Issue
Block a user