From 46c8ef921599c27ea2ac85e90b4bb751b79f9b40 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Sat, 15 Sep 2018 13:57:11 +0200 Subject: [PATCH] feat: First steps to a better review --- src/models/vocab.ts | 63 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 7 deletions(-) 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) // } -} +};