As a developer, I want a shared interface between all format and type of questions
Requirements
Implement the following:
a Question abstract class
a TextQuestion abstract class that extends Question
an QuestionFormat enum. The discriminator used in the Question to determine which model to use. The values are:
association
multiple_choices
single_word
sentence
draw
listen
blank
an InstructionType enum. The type of instruction to display. The values are:
spell_romaji: spell in romaji the kana/kanji/vocabulary word
spell_kana: spell in kana the kana/kanji/vocabulary word
spell: spell the sentence using kana and kanji
translate_to_app_language: translate from Japanese to the application language
translate_to_japanese: translate from the application language to Japanese
custom: indicates that the format question is using a non-generic instruction
a KnowledgeUpdate class that represent the grade for a specific element.
KnowledgeUpdate spec
I'm using OpenAPI spec for simplicity.
```yaml
KnowledgeUpdate:
properties:
uid:
type: ResourceUid
description: Unique identifier of the resource concerned by this update
grade:
type: integer
default: 3
minimum: 0
description: |
Grade of the update, represent the facility to remember the correct answer.
3 -> was easy to remember
2 -> failed to remember right away but remembered the second time
1 -> was difficult to remember (2 errors before recognizing it)
0 -> completely forgotten (3 errors)
isNew:
type: boolean
default: false
description: Indicate if it's the first time the resource if shown
required:
- type
- uid
- grade
```
Question abstract class content
I'm using OpenAPI spec for simplicity.
```yaml
Question:
properties:
format:
$ref: "#/components/schemas/QuestionFormat"
instruction:
$ref: "#/components/schemas/InstructionTypes"
subject:
description: Subject of the question
type: string
example:
- "時"
- "じ"
- "ji"
- "Time"
subject_tts:
description: String to use for the TTS of the subject. Only available if the subject is in Japanese
type: string
example: "じ"
explanation:
type: string
description: Optional explanation to display after the question is answered
knowledge_updates:
type: array
minimum: 1
items:
$ref: "#/components/schemas/KnowledgeUpdate"
skipped:
type: boolean
description: Indicate if the question was skipped or not
default: false
required:
- format
- subject
- knowledge_updates
```
TextQuestion abstract class content
I'm using OpenAPI spec for simplicity.
```yaml
TextQuestion:
description: Representation of a text based question
allOf:
- $ref: "#/components/schemas/Question"
- properties:
accepted_answers:
description: |
List of the accepted answers to the question
type: array
minimum: 1
items:
type: string
options:
description: |
List of boxes to build an answer. Those are used if the keyboard isn't available.
If the instruction `spell` is passed, the maximum number of elements should be four (4). If `spell_kana` is passed, the options should be bite size meaning only one character by option.
type: array
items:
properties:
text:
type: string
tts:
type: string
description: Text to use for the TTS of this option
required:
- text
required:
- accepted_answers
- options
```
What needs to be done
Implement the following:
the class KnowledgeUpdate under src/practice/questions/models
the abstract class Question under src/practice/questions/models
the abstract class TextQuestion under src/practice/questions/models
the enums QuestionFormats and IntructionTypes under src/practice/questions/constants
As a developer, I want a shared interface between all format and type of questions
Requirements
Implement the following:
Question
abstract classTextQuestion
abstract class that extendsQuestion
QuestionFormat
enum. The discriminator used in theQuestion
to determine which model to use. The values are:association
multiple_choices
single_word
sentence
draw
listen
blank
InstructionType
enum. The type of instruction to display. The values are:spell_romaji
: spell in romaji the kana/kanji/vocabulary wordspell_kana
: spell in kana the kana/kanji/vocabulary wordspell
: spell the sentence using kana and kanjitranslate_to_app_language
: translate from Japanese to the application languagetranslate_to_japanese
: translate from the application language to Japanesecustom
: indicates that the format question is using a non-generic instructionKnowledgeUpdate
class that represent the grade for a specific element.
I'm using OpenAPI spec for simplicity. ```yaml KnowledgeUpdate: properties: uid: type: ResourceUid description: Unique identifier of the resource concerned by this update grade: type: integer default: 3 minimum: 0 description: | Grade of the update, represent the facility to remember the correct answer. 3 -> was easy to remember 2 -> failed to remember right away but remembered the second time 1 -> was difficult to remember (2 errors before recognizing it) 0 -> completely forgotten (3 errors) isNew: type: boolean default: false description: Indicate if it's the first time the resource if shown required: - type - uid - grade ```KnowledgeUpdate
spec
I'm using OpenAPI spec for simplicity. ```yaml Question: properties: format: $ref: "#/components/schemas/QuestionFormat" instruction: $ref: "#/components/schemas/InstructionTypes" subject: description: Subject of the question type: string example: - "時" - "じ" - "ji" - "Time" subject_tts: description: String to use for the TTS of the subject. Only available if the subject is in Japanese type: string example: "じ" explanation: type: string description: Optional explanation to display after the question is answered knowledge_updates: type: array minimum: 1 items: $ref: "#/components/schemas/KnowledgeUpdate" skipped: type: boolean description: Indicate if the question was skipped or not default: false required: - format - subject - knowledge_updates ```Question
abstract class content
I'm using OpenAPI spec for simplicity. ```yaml TextQuestion: description: Representation of a text based question allOf: - $ref: "#/components/schemas/Question" - properties: accepted_answers: description: | List of the accepted answers to the question type: array minimum: 1 items: type: string options: description: | List of boxes to build an answer. Those are used if the keyboard isn't available. If the instruction `spell` is passed, the maximum number of elements should be four (4). If `spell_kana` is passed, the options should be bite size meaning only one character by option. type: array items: properties: text: type: string tts: type: string description: Text to use for the TTS of this option required: - text required: - accepted_answers - options ```TextQuestion
abstract class contentWhat needs to be done
Implement the following:
KnowledgeUpdate
undersrc/practice/questions/models
Question
undersrc/practice/questions/models
TextQuestion
undersrc/practice/questions/models
QuestionFormats
andIntructionTypes
undersrc/practice/questions/constants
Dependencies
Child of #160
Depends on:
216