Fix deck data
This commit is contained in:
1 parent
9a7578727b
commit
08ab55f283
7 files changed
+145
-96
No files matched your search
+4
-4
@@ -11,7 +11,7 @@ use iced_core::window::Position;
|
||||
use iced_core::window::settings::PlatformSpecific;
|
||||
use iced_core::{Font, Size, Theme};
|
||||
use log::info;
|
||||
use parking_lot::RwLock;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use rusqlite::Connection;
|
||||
use crate::data::repositories::Repository;
|
||||
use crate::data_provider::card_states::CardStateRepository;
|
||||
@@ -65,7 +65,7 @@ pub struct AppState {
|
||||
pub decks: DeckRepository,
|
||||
pub word_groups: WordGroupRepository,
|
||||
pub card_states: CardStateRepository,
|
||||
pub connection: Arc<RwLock<SqliteConnection>>,
|
||||
pub connection: Arc<Mutex<SqliteConnection>>,
|
||||
pub sync_data: Arc<RwLock<AppSettings>>,
|
||||
pub history: HistoryRepository,
|
||||
}
|
||||
@@ -78,7 +78,7 @@ impl Default for AppState {
|
||||
|
||||
impl AppState {
|
||||
pub fn new() -> Self {
|
||||
let connection = Arc::new(RwLock::new(SqliteConnection::default()));
|
||||
let connection = Arc::new(Mutex::new(SqliteConnection::default()));
|
||||
Self {
|
||||
dictionary: WordRepository::new(connection.clone()),
|
||||
decks: DeckRepository::new(connection.clone()),
|
||||
@@ -95,7 +95,7 @@ impl AppState {
|
||||
}
|
||||
|
||||
pub fn fill_state(state: &mut AppState) {
|
||||
let connection = state.connection.read();
|
||||
let connection = state.connection.lock();
|
||||
|
||||
let setting = load_settings(&connection);
|
||||
|
||||
|
||||
Reference in new issue
Block a user