Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 67053d3

Browse filesBrowse files
committed
change options to an array
change options to an array
1 parent da398fd commit 67053d3
Copy full SHA for 67053d3

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Open diff view settings
Collapse file

‎app.py‎

Copy file name to clipboardExpand all lines: app.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def post(self):
111111
type: string
112112
description: the name of the question
113113
options:
114-
type: string
114+
type: array
115+
items:
116+
type: string
115117
description: the options of the question
116118
correct:
117119
type: integer
Collapse file

‎question_review.py‎

Copy file name to clipboardExpand all lines: question_review.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def add_record(data):
3131
# require data contains a "name" key and a "options" key and a "correct" key(data is a dict)
3232
if 'name' not in data or 'options' not in data or 'correct' not in data:
3333
return False
34+
35+
# Convert options to a list if it's not already
36+
if not isinstance(data['options'], list):
37+
data['options'] = [data['options']]
3438

3539
table.create(data)
3640
return True

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.