aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorJoris2021-11-14 23:25:55 +0100
committerJoris2021-11-19 11:42:20 +0100
commit9f94611a42d41cf94cdccb00b5d2eec0d5d02970 (patch)
tree9bab5bc342e22aa38b13a2dbd3525bbfe2beedb5 /src/model
parent59c44b15010eea5490896a5b5d427b415ad6f56a (diff)
downloadflashcards-9f94611a42d41cf94cdccb00b5d2eec0d5d02970.tar.gz
flashcards-9f94611a42d41cf94cdccb00b5d2eec0d5d02970.tar.bz2
flashcards-9f94611a42d41cf94cdccb00b5d2eec0d5d02970.zip
Add initial working version
Diffstat (limited to 'src/model')
-rw-r--r--src/model/card.rs8
-rw-r--r--src/model/deck.rs5
-rw-r--r--src/model/difficulty.rs16
-rw-r--r--src/model/mod.rs3
4 files changed, 32 insertions, 0 deletions
diff --git a/src/model/card.rs b/src/model/card.rs
new file mode 100644
index 0000000..3ac395e
--- /dev/null
+++ b/src/model/card.rs
@@ -0,0 +1,8 @@
+use crate::space_repetition;
+
+#[derive(Debug)]
+pub struct Card {
+ pub question: String,
+ pub responses: Vec<String>,
+ pub state: space_repetition::State,
+}
diff --git a/src/model/deck.rs b/src/model/deck.rs
new file mode 100644
index 0000000..769b38c
--- /dev/null
+++ b/src/model/deck.rs
@@ -0,0 +1,5 @@
+#[derive(Debug, Clone)]
+pub struct Entry {
+ pub part_1: Vec<String>,
+ pub part_2: Vec<String>,
+}
diff --git a/src/model/difficulty.rs b/src/model/difficulty.rs
new file mode 100644
index 0000000..ea5a9ce
--- /dev/null
+++ b/src/model/difficulty.rs
@@ -0,0 +1,16 @@
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub enum Difficulty {
+ Again,
+ Hard,
+ Good,
+ Easy,
+}
+
+pub fn label(difficulty: Difficulty) -> String {
+ match difficulty {
+ Difficulty::Again => "Recommencer".to_string(),
+ Difficulty::Hard => "Difficile".to_string(),
+ Difficulty::Good => "Bon".to_string(),
+ Difficulty::Easy => "Facile".to_string(),
+ }
+}
diff --git a/src/model/mod.rs b/src/model/mod.rs
new file mode 100644
index 0000000..bbd7891
--- /dev/null
+++ b/src/model/mod.rs
@@ -0,0 +1,3 @@
+pub mod card;
+pub mod deck;
+pub mod difficulty;