Solve repetition

This commit is contained in:
micialware committed 2026-09-04 17:26:59 +03:00
1 parent 08ab55f283
commit a68e56e861
10 files changed
+24 -27

No files matched your search

+8 -6
View File
@@ -9,17 +9,16 @@ use crate::navigation::{KeyPressedPage, NavigatedPage, Page, RootMessage};
use crate::notification::{MaybeError, NotificationData};
use crate::styling::*;
use crate::{push_error, push_error_task};
use chrono::Local;
use iced::alignment::Horizontal::Center;
use iced::keyboard::key::Physical::Code;
use iced::widget::text::Style;
use iced::widget::{Column, button, column, container, row, rule, space, text, tooltip};
use iced::{Element, Fill, Task, Theme, alignment, keyboard};
use parking_lot::Mutex;
use rodio::MixerDeviceSink;
use std::collections::HashSet;
use std::sync::Arc;
use tokio::task::spawn_blocking;
use crate::data::repositories::Repository;
pub struct RepetitionState {
state: AppState,
@@ -108,7 +107,8 @@ impl RepetitionState {
) -> Result<RepetitionState, NotificationData> {
let mut card_set = DeckData::new(&set, state.clone())?;
let (word, stat) = card_set.next();
let word = state.dictionary.read().get_static(word).unwrap();
let stat = state.card_states.read().get_static(stat).unwrap();
let sink_handle = if set.forward.contains("speech") || set.backward.contains("speech") {
rodio::DeviceSinkBuilder::open_default_sink().ok()
} else {
@@ -150,9 +150,11 @@ impl RepetitionState {
self.open = false;
self.opened.insert(self.current_word.id);
let next = self.set.next();
self.current_word = next.0;
self.current_statistic = next.1;
let (word, state) = self.set.next();
let word = self.state.dictionary.read().get_static(word).unwrap();
let stat = self.state.card_states.read().get_static(state).unwrap();
self.current_word = word;
self.current_statistic = stat;
if self.settings.require_speech() && self.sink.is_some() {
let sink = self.sink.clone();