fix: enforce images are present in all skills

This commit is contained in:
Daniel Kantor 2023-10-26 16:16:07 +02:00 committed by Daniel Kantor
parent 428761938f
commit 4b59830b21
7 changed files with 40 additions and 15 deletions

View File

@ -20,6 +20,10 @@ New words:
Translation: the woman
Also accepted:
- the female
Images:
- man1
- man2
- man3
Phrases:
- Phrase: La femme dit bonjour

View File

@ -179,17 +179,17 @@ le""",
},
{
"formInTargetLanguage": "la femme",
"group": "2729f22db5bf",
"id": "bd13dcfe4d22",
"group": "1c08a1db48bf",
"id": "38734148215a",
"meaningInSourceLanguage": "the woman",
"pictures": None,
"pictures": ["man1.jpg", "man2.jpg", "man3.jpg"],
"priority": 0,
"type": "cards",
},
{
"formInTargetLanguage": ["la femme", "la dame"],
"group": "2729f22db5bf",
"id": "19a877a0955d",
"group": "1c08a1db48bf",
"id": "1f9d7215444b",
"phrase": [
{
"definition": """la
@ -198,15 +198,15 @@ le""",
},
{"definition": "femme", "word": "woman"},
],
"pictures": None,
"pictures": ["man1.jpg", "man2.jpg", "man3.jpg"],
"priority": 1,
"type": "shortInput",
},
{
"answer": "la femme",
"audio": "cabd9d1b9cae7227bd640f6ec302ea9ce0c551e7f94d23a7ff843ced6846c7da",
"group": "2729f22db5bf",
"id": "f91de23ae173",
"group": "1c08a1db48bf",
"id": "0f716658c347",
"meaning": "the woman",
"priority": 1,
"type": "listeningExercise",

View File

@ -57,12 +57,15 @@
"type": "array",
"items": {
"type": "string"
}
},
"minItems": 3,
"maxItems": 3
}
},
"required": [
"Word",
"Translation"
"Translation",
"Images"
]
}
},

View File

@ -20,6 +20,10 @@ New words:
Translation: the woman
Also accepted:
- the female
Images:
- man1
- man2
- man3
Phrases:
- Phrase: La femme dit bonjour

View File

@ -458,7 +458,7 @@ def test_load_course_output_matches_value(fs):
Word(
in_target_language=["la femme", "la dame"],
in_source_language=["the woman", "the female"],
pictures=None,
pictures=["man1", "man2", "man3"],
),
]
assert result.special_characters == [
@ -871,6 +871,11 @@ def test_load_skill_complains_about_misspelled_word_in_source_language(load_yaml
{
"Translation": fake_word_value,
"Word": "ola",
"Images": [
"hello1",
"hello2",
"hello3",
],
}
],
}
@ -905,6 +910,11 @@ def test_load_skill_complains_about_misspelled_word_in_target_language(load_yaml
{
"Translation": "le asd",
"Word": fake_word_value,
"Images": [
"hello1",
"hello2",
"hello3",
],
}
],
}

View File

@ -90,9 +90,13 @@
new Image().src = `images/${imageName}`
}
challenges
.filter(({ type }) => type === "cards")
.map(({ pictures }: CardChallengeType) => pictures.map(preloadImage))
challenges &&
challenges
.filter(({ type }) => type === "cards")
.map(
({ pictures }: CardChallengeType) =>
pictures && pictures.map(preloadImage)
)
$: alternativeChallenges =
currentChallenge &&

View File

@ -176,7 +176,7 @@ indent-string=' '
max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000
max-module-lines=1010
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.