Removed futures from dependencies and fixed the logic on how correct answers are calculated
parent
a65a9591af
commit
460b3e2790
|
@ -1405,7 +1405,6 @@ name = "flashcards"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dioxus",
|
"dioxus",
|
||||||
"futures",
|
|
||||||
"rand 0.9.1",
|
"rand 0.9.1",
|
||||||
"serde",
|
"serde",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
|
@ -11,7 +11,6 @@ dioxus = { version = "0.6.3", features = [] }
|
||||||
toml = { version = "0.8" }
|
toml = { version = "0.8" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
rand = { version = "0.9" }
|
rand = { version = "0.9" }
|
||||||
futures = { version = "0.3" }
|
|
||||||
tokio = { version = "1.45" }
|
tokio = { version = "1.45" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
--selection: goldenrod;
|
--selection: goldenrod;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #0f1116;
|
background-color: #0f1116;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
@ -31,6 +28,7 @@ body {
|
||||||
color: var(--correct);
|
color: var(--correct);
|
||||||
text-shadow: var(--correct-shadow) 1px 1px 30px;
|
text-shadow: var(--correct-shadow) 1px 1px 30px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
&.visible {
|
&.visible {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -4,7 +4,6 @@ use dioxus::{
|
||||||
desktop::{Config, LogicalSize, WindowBuilder},
|
desktop::{Config, LogicalSize, WindowBuilder},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use futures::StreamExt;
|
|
||||||
use models::{Question, Questions};
|
use models::{Question, Questions};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
|
@ -68,12 +67,19 @@ pub fn QuestionForm() -> Element {
|
||||||
.count()
|
.count()
|
||||||
});
|
});
|
||||||
let actual_correct = use_memo(move || {
|
let actual_correct = use_memo(move || {
|
||||||
current
|
let current_lock = current.read();
|
||||||
.read()
|
let incorrectly_checked = current_lock
|
||||||
|
.answers
|
||||||
|
.iter()
|
||||||
|
.filter(|a| !a.is_correct.unwrap_or_default() && a.checked)
|
||||||
|
.count();
|
||||||
|
let correctly_checked = current_lock
|
||||||
.answers
|
.answers
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|a| a.is_correct.unwrap_or_default() && a.checked)
|
.filter(|a| a.is_correct.unwrap_or_default() && a.checked)
|
||||||
.count()
|
.count();
|
||||||
|
|
||||||
|
correctly_checked.saturating_sub(incorrectly_checked)
|
||||||
});
|
});
|
||||||
|
|
||||||
let total_questions = QUESTIONS.len();
|
let total_questions = QUESTIONS.len();
|
||||||
|
|
Loading…
Reference in New Issue