Fix some bugs in repo and repetitions page
This commit is contained in:
1 parent
bdf71fa0b7
commit
b3b5785fd7
2 files changed
+6
-5
No files matched your search
@@ -228,7 +228,7 @@ impl<T> EntityHandle<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_id(id: Id) -> Self {
|
pub fn from_id(id: Id) -> Self {
|
||||||
Self::new(id, id.0 as usize, false)
|
Self::new(id, id.0 as usize, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index(&self) -> usize {
|
pub fn index(&self) -> usize {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use std::collections::BTreeMap;
|
||||||
use crate::app::AppState;
|
use crate::app::AppState;
|
||||||
use crate::core::deck::DeckData;
|
use crate::core::deck::DeckData;
|
||||||
use crate::core::srs::{AppendMode, OrderMode};
|
use crate::core::srs::{AppendMode, OrderMode};
|
||||||
@@ -32,7 +33,7 @@ use std::sync::Arc;
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RepetitionsState {
|
pub struct RepetitionsState {
|
||||||
selected_deck_handle: Option<EntityHandle<DeckSettings>>,
|
selected_deck_handle: Option<EntityHandle<DeckSettings>>,
|
||||||
decks: HashMap<EntityHandle<DeckSettings>, DeckViewData>,
|
decks: BTreeMap<EntityHandle<DeckSettings>, DeckViewData>,
|
||||||
state: AppState,
|
state: AppState,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
|||||||
None
|
None
|
||||||
} else if let GoToSettings = message {
|
} else if let GoToSettings = message {
|
||||||
Some(RepetitionSettings(RepetitionSettingsState::new(
|
Some(RepetitionSettings(RepetitionSettingsState::new(
|
||||||
EntityHandle::from_id(self.selected_deck().unwrap().id),
|
self.selected_deck_handle.unwrap(),
|
||||||
self.state.clone(),
|
self.state.clone(),
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
@@ -245,7 +246,7 @@ impl RepetitionsState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_decks_from_state(state: &AppState) -> HashMap<EntityHandle<DeckSettings>, DeckViewData> {
|
fn get_decks_from_state(state: &AppState) -> BTreeMap<EntityHandle<DeckSettings>, DeckViewData> {
|
||||||
state
|
state
|
||||||
.decks
|
.decks
|
||||||
.read()
|
.read()
|
||||||
@@ -266,7 +267,7 @@ impl RepetitionsState {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect::<HashMap<_, _>>()
|
.collect::<BTreeMap<_, _>>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user