[Eva] fix show_words: json.loads для current_level_words
This commit is contained in:
@@ -298,7 +298,12 @@ async def show_words(request: Request):
|
|||||||
if difficulty == "medium" and list_opened >= 1:
|
if difficulty == "medium" and list_opened >= 1:
|
||||||
raise HTTPException(400, "Word list already used on Medium difficulty")
|
raise HTTPException(400, "Word list already used on Medium difficulty")
|
||||||
|
|
||||||
level_words = progress["current_level_words"] or []
|
raw = progress["current_level_words"]
|
||||||
|
if isinstance(raw, str):
|
||||||
|
level_words = json.loads(raw) if raw else []
|
||||||
|
else:
|
||||||
|
level_words = raw or []
|
||||||
|
|
||||||
words = [
|
words = [
|
||||||
{"word_pl": w.get("word_pl"), "translation": w.get("translation")}
|
{"word_pl": w.get("word_pl"), "translation": w.get("translation")}
|
||||||
for w in level_words
|
for w in level_words
|
||||||
|
|||||||
Reference in New Issue
Block a user