feat: First steps to a better review

This commit is contained in:
Alexander Polynomdivision 2018-09-15 13:57:11 +02:00
parent ef4ae740b8
commit 46c8ef9215

View File

@ -1,34 +1,34 @@
export enum ReviewMode { export enum ReviewMode {
GER_TO_LAT, GER_TO_LAT,
LAT_TO_GER, LAT_TO_GER,
} };
export enum VocabType { export enum VocabType {
NOMEN, NOMEN,
VERB, VERB,
ADJEKTIV, ADJEKTIV,
ADVERB ADVERB
} };
export interface INomenData { export interface INomenData {
grundform: string; grundform: string;
genitiv: string; genitiv: string;
genus: string; genus: string;
} };
export interface IVerbData { export interface IVerbData {
grundform: string; grundform: string;
// 1. Person // 1. Person
praesens: string; praesens: string;
perfekt: string; perfekt: string;
// TODO: Was ist das PPP? ppp: string;
} };
export interface IAdjektivData { export interface IAdjektivData {
grundform: string; grundform: string;
nominativ_a: string; nominativ_a: string;
nominativ_b: string; nominativ_b: string;
} };
export interface IVocab { export interface IVocab {
// If a word has multiple meanings // If a word has multiple meanings
@ -43,9 +43,58 @@ export interface IVocab {
id: number; 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) => { export const typeToPoints = (VocabType type) => {
switch (type) { switch (type) {
// Nomen: 2P + 1 (Wenn richtig) // Nomen: 2P + 1 (Wenn richtig)
// //
} }
} };