forked from mrlan/EnglishPal
手动输入的文字最高难度等级是4
parent
3bc61a602f
commit
8d8b9197b6
|
@ -88,13 +88,13 @@ def article():
|
||||||
content = data.get("content", "")
|
content = data.get("content", "")
|
||||||
source = data.get("source", "")
|
source = data.get("source", "")
|
||||||
question = data.get("question", "")
|
question = data.get("question", "")
|
||||||
level = data.get("level", "5")
|
level = data.get("level", "4")
|
||||||
if content:
|
if content:
|
||||||
try: # check level
|
try: # check level
|
||||||
if level not in [str(x + 1) for x in range(5)]:
|
if level not in ['1', '2', '3', '4']:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return "Level must be between 1 and 5"
|
return "Level must be between 1 and 4."
|
||||||
add_article(content, source, level, question)
|
add_article(content, source, level, question)
|
||||||
_update_context()
|
_update_context()
|
||||||
title = content.split('\n')[0]
|
title = content.split('\n')[0]
|
||||||
|
|
Loading…
Reference in New Issue