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