Fixing some code problems
This commit is contained in:
+6
-6
@@ -47,7 +47,7 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
||||
|
||||
let selected_set = self.selected_deck_mut().unwrap();
|
||||
if selected_set.append_mode == AppendMode::Full {
|
||||
Self::append_all_words(&clone.lock().unwrap(), selected_set);
|
||||
Self::append_all_words(&mut clone.lock().unwrap(), selected_set);
|
||||
selected_set.existing_words_indices = selected_set.available_words_indices.clone();
|
||||
} else {
|
||||
if selected_set
|
||||
@@ -220,8 +220,8 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
||||
}
|
||||
|
||||
let deck = self.selected_deck().unwrap();
|
||||
let state = self.state.lock().unwrap();
|
||||
Self::append_words(&state, &deck.general_settings, adding.into_iter());
|
||||
let mut state = self.state.lock().unwrap();
|
||||
Self::append_words(&mut state, &deck.general_settings, adding.into_iter());
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
@@ -565,7 +565,7 @@ impl RepetitionsState {
|
||||
}
|
||||
|
||||
impl RepetitionsState {
|
||||
fn append_all_words(state: &AppState, deck: &DeckViewData) {
|
||||
fn append_all_words(state: &mut AppState, deck: &DeckViewData) {
|
||||
let existing = deck.existing_words_indices.as_ref().unwrap();
|
||||
let mut created_set = HashSet::with_capacity(existing.len());
|
||||
existing.iter().for_each(|c| {
|
||||
@@ -580,7 +580,7 @@ impl RepetitionsState {
|
||||
.cloned();
|
||||
Self::append_words(state, deck, required);
|
||||
}
|
||||
fn append_words(state: &AppState, deck: &DeckSettings, indices: impl Iterator<Item = usize>) {
|
||||
fn append_words(state: &mut AppState, deck: &DeckSettings, indices: impl Iterator<Item = usize>) {
|
||||
let words = &state.dictionary;
|
||||
let stats = &mut indices
|
||||
.map(|i| {
|
||||
@@ -596,7 +596,7 @@ impl RepetitionsState {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !stats.is_empty() {
|
||||
add_stat_list(stats, &state.connection);
|
||||
add_stat_list(stats, &mut state.connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user