Fix repetition display bug and history find bug
This commit is contained in:
+1
-1
@@ -18,12 +18,12 @@ use iced::widget::text_input::default;
|
|||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{Border, Color, Shadow, Task};
|
use iced::{Border, Color, Shadow, Task};
|
||||||
use iced_core::Length::Fill;
|
use iced_core::Length::Fill;
|
||||||
|
use parking_lot::Mutex;
|
||||||
use rand::random_range;
|
use rand::random_range;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parking_lot::Mutex;
|
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
+3
-9
@@ -9,8 +9,8 @@ use iced::alignment::Horizontal::Center;
|
|||||||
use iced::widget::space::horizontal;
|
use iced::widget::space::horizontal;
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{Element, Fill, FillPortion, Task};
|
use iced::{Element, Fill, FillPortion, Task};
|
||||||
use std::sync::Arc;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct HistoryState {
|
pub struct HistoryState {
|
||||||
@@ -52,14 +52,8 @@ impl HistoryState {
|
|||||||
let history = get_history_of_set(id);
|
let history = get_history_of_set(id);
|
||||||
let words = history
|
let words = history
|
||||||
.iter()
|
.iter()
|
||||||
.map(|item| {
|
.filter_map(|item| state.dictionary.iter().find(|w| w.id == item.word_id))
|
||||||
state
|
.cloned()
|
||||||
.dictionary
|
|
||||||
.iter()
|
|
||||||
.find(|w| w.id == item.word_id)
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
+1
-1
@@ -16,13 +16,13 @@ use iced::{Element, Task};
|
|||||||
use iced_core::Alignment::Center;
|
use iced_core::Alignment::Center;
|
||||||
use iced_core::Length::Fill;
|
use iced_core::Length::Fill;
|
||||||
use iced_core::Padding;
|
use iced_core::Padding;
|
||||||
|
use parking_lot::Mutex;
|
||||||
use rfd::AsyncFileDialog;
|
use rfd::AsyncFileDialog;
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parking_lot::Mutex;
|
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
use zip::ZipArchive;
|
use zip::ZipArchive;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
use crate::data_provider::card_stats::{delete_stat, load_stats_of_deck, update_stat_score};
|
|
||||||
use crate::data_provider::history::{push_note, HistoryItem};
|
|
||||||
use crate::AppState;
|
use crate::AppState;
|
||||||
|
use crate::data_provider::card_stats::{delete_stat, load_stats_of_deck, update_stat_score};
|
||||||
|
use crate::data_provider::history::{HistoryItem, push_note};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use rand::distr::weighted::WeightedIndex;
|
|
||||||
use rand::distr::Distribution;
|
use rand::distr::Distribution;
|
||||||
|
use rand::distr::weighted::WeightedIndex;
|
||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
use rand::rng;
|
use rand::rng;
|
||||||
use rand::rngs::ThreadRng;
|
use rand::rngs::ThreadRng;
|
||||||
@@ -12,8 +12,8 @@ use rayon::iter::IndexedParallelIterator;
|
|||||||
use rayon::iter::IntoParallelRefIterator;
|
use rayon::iter::IntoParallelRefIterator;
|
||||||
use rayon::iter::ParallelIterator;
|
use rayon::iter::ParallelIterator;
|
||||||
use rhai::{Engine, Scope};
|
use rhai::{Engine, Scope};
|
||||||
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSqlOutput, ValueRef};
|
|
||||||
use rusqlite::ToSql;
|
use rusqlite::ToSql;
|
||||||
|
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSqlOutput, ValueRef};
|
||||||
use std::cmp::PartialEq;
|
use std::cmp::PartialEq;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
|
|||||||
+1
-1
@@ -28,10 +28,10 @@ use chrono::NaiveDate;
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use iced::keyboard::Event;
|
use iced::keyboard::Event;
|
||||||
use iced::{Element, Task};
|
use iced::{Element, Task};
|
||||||
|
use parking_lot::Mutex;
|
||||||
use reqwest::Error;
|
use reqwest::Error;
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parking_lot::Mutex;
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
impl Default for ScreenState {
|
impl Default for ScreenState {
|
||||||
|
|||||||
+2
-2
@@ -11,10 +11,10 @@ use iced::keyboard::key::Physical::Code;
|
|||||||
use iced::widget::text::Style;
|
use iced::widget::text::Style;
|
||||||
use iced::widget::{Column, button, column, container, row, rule, space, text, tooltip};
|
use iced::widget::{Column, button, column, container, row, rule, space, text, tooltip};
|
||||||
use iced::{Element, Fill, Task, Theme, alignment, keyboard};
|
use iced::{Element, Fill, Task, Theme, alignment, keyboard};
|
||||||
|
use parking_lot::Mutex;
|
||||||
use rodio::MixerDeviceSink;
|
use rodio::MixerDeviceSink;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parking_lot::Mutex;
|
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
|
|
||||||
pub struct RepetitionState {
|
pub struct RepetitionState {
|
||||||
@@ -273,7 +273,7 @@ impl RepetitionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn draw_description(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
fn draw_description(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
||||||
match word.additional.get("context") {
|
match word.additional.get("description") {
|
||||||
None => space().into(),
|
None => space().into(),
|
||||||
Some(context) => text!("{}", context).size(24).into(),
|
Some(context) => text!("{}", context).size(24).into(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ use iced::widget::{button, column, row, scrollable, space, text, text_input};
|
|||||||
use iced::{Element, Task};
|
use iced::{Element, Task};
|
||||||
use iced_core::Length::Fill;
|
use iced_core::Length::Fill;
|
||||||
use iced_core::{Padding, Theme, color};
|
use iced_core::{Padding, Theme, color};
|
||||||
use std::sync::Arc;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
||||||
pub struct RepetitionSettingsState {
|
pub struct RepetitionSettingsState {
|
||||||
set: DeckSettings,
|
set: DeckSettings,
|
||||||
index: usize,
|
index: usize,
|
||||||
|
|||||||
+1
-1
@@ -22,9 +22,9 @@ use iced::{Background, Border, Center, Color, Element, Fill, Length, Shadow, Tas
|
|||||||
use iced_core::Padding;
|
use iced_core::Padding;
|
||||||
use iced_core::border::Radius;
|
use iced_core::border::Radius;
|
||||||
use iced_core::svg::Handle;
|
use iced_core::svg::Handle;
|
||||||
|
use parking_lot::Mutex;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parking_lot::Mutex;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RepetitionsState {
|
pub struct RepetitionsState {
|
||||||
|
|||||||
+1
-1
@@ -15,8 +15,8 @@ use iced::{Element, Task, alignment};
|
|||||||
use iced_core::Alignment::Center;
|
use iced_core::Alignment::Center;
|
||||||
use iced_core::Background;
|
use iced_core::Background;
|
||||||
use iced_core::Color;
|
use iced_core::Color;
|
||||||
use std::sync::Arc;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct SelectorState {
|
pub struct SelectorState {
|
||||||
pub set: KanaSet,
|
pub set: KanaSet,
|
||||||
|
|||||||
+1
-1
@@ -9,8 +9,8 @@ use iced::widget::button::danger;
|
|||||||
use iced::widget::container::rounded_box;
|
use iced::widget::container::rounded_box;
|
||||||
use iced::widget::{button, column, container, progress_bar, row, space, text, toggler};
|
use iced::widget::{button, column, container, progress_bar, row, space, text, toggler};
|
||||||
use iced::{Center, Element, Fill, Font, Length, Task};
|
use iced::{Center, Element, Fill, Font, Length, Task};
|
||||||
use std::sync::Arc;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
+1
-1
@@ -8,8 +8,8 @@ use crate::{AppState, RootMessage};
|
|||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
use iced::widget::{button, column, row, rule, scrollable, text, text_input};
|
use iced::widget::{button, column, row, rule, scrollable, text, text_input};
|
||||||
use iced::{Element, Fill, Task};
|
use iced::{Element, Fill, Task};
|
||||||
use std::sync::Arc;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WordState {
|
pub struct WordState {
|
||||||
|
|||||||
Reference in New Issue
Block a user