diff --git a/src/models/vocab.ts b/src/models/vocab.ts index ff2fc52..6076cd5 100644 --- a/src/models/vocab.ts +++ b/src/models/vocab.ts @@ -1,34 +1,34 @@ export enum ReviewMode { GER_TO_LAT, LAT_TO_GER, -} +}; export enum VocabType { NOMEN, VERB, ADJEKTIV, ADVERB -} +}; export interface INomenData { grundform: string; genitiv: string; genus: string; -} +}; export interface IVerbData { grundform: string; // 1. Person praesens: string; perfekt: string; - // TODO: Was ist das PPP? -} + ppp: string; +}; export interface IAdjektivData { grundform: string; nominativ_a: string; nominativ_b: string; -} +}; export interface IVocab { // If a word has multiple meanings @@ -43,9 +43,58 @@ export interface IVocab { id: number; }; +// What kind of question should be answered +export enum IReviewQType { + GERMAN, + + NOMEN_GENITIV, + NOMEN_GENUS, + + ADJ_NOM_A, + ADJ_NOM_B, + + VERB_PRAESENS, + VERB_PERFEKT, + VERB_PPP +}; + +export interface IReviewCard { + question: string; + // If a question can have multiple answers + answers: string[]; + + qtype: IReviewQType; +}; + +// Turn a vocabulaty item into a series of questions about the item +export function vocabToReviewCard(vocab: IVocab): IReviewCard[] { + switch (vocab.type) { + case VocabType.NOMEN: + const latin = vocab.latin as INomenData; + return [{ + // Latin -> German + question: latin.grundform, + answers: vocab.german, + qtype: IReviewQType.GERMAN, + }, { + // Latin -> Genitiv + question: latin.grundform, + answers: [latin.genitiv], + qtype: IReviewQType.NOMEN_GENITIV, + }, { + // Latin -> Genus + question: latin.grundform, + answers: [latin.genus], + qtype: IReviewQType.NOMEN_GENUS, + }]; + default: + return []; + } +} + export const typeToPoints = (VocabType type) => { switch (type) { // Nomen: 2P + 1 (Wenn richtig) // } -} +};