diff --git a/rslib/src/backend/deckconfig.rs b/rslib/src/backend/deckconfig.rs index debce059b..5e9590a4c 100644 --- a/rslib/src/backend/deckconfig.rs +++ b/rslib/src/backend/deckconfig.rs @@ -5,7 +5,7 @@ use super::Backend; pub(super) use crate::backend_proto::deckconfig_service::Service as DeckConfigService; use crate::{ backend_proto as pb, - deckconf::{DeckConf, DeckConfSchema11, UpdateDeckConfigsIn}, + deckconfig::{DeckConfSchema11, DeckConfig, UpdateDeckConfigsIn}, prelude::*, }; @@ -15,7 +15,7 @@ impl DeckConfigService for Backend { input: pb::AddOrUpdateDeckConfigLegacyIn, ) -> Result { let conf: DeckConfSchema11 = serde_json::from_slice(&input.config)?; - let mut conf: DeckConf = conf.into(); + let mut conf: DeckConfig = conf.into(); self.with_col(|col| { col.transact_no_undo(|col| { col.add_or_update_deck_config(&mut conf, input.preserve_usn_and_mtime)?; @@ -72,8 +72,8 @@ impl DeckConfigService for Backend { } } -impl From for pb::DeckConfig { - fn from(c: DeckConf) -> Self { +impl From for pb::DeckConfig { + fn from(c: DeckConfig) -> Self { pb::DeckConfig { id: c.id.0, name: c.name, @@ -95,9 +95,9 @@ impl From for UpdateDeckConfigsIn { } } -impl From for DeckConf { +impl From for DeckConfig { fn from(c: pb::DeckConfig) -> Self { - DeckConf { + DeckConfig { id: c.id.into(), name: c.name, mtime_secs: c.mtime_secs.into(), diff --git a/rslib/src/card/mod.rs b/rslib/src/card/mod.rs index b59e7c52d..cc82c5f85 100644 --- a/rslib/src/card/mod.rs +++ b/rslib/src/card/mod.rs @@ -11,7 +11,7 @@ use serde_repr::{Deserialize_repr, Serialize_repr}; use crate::{ collection::Collection, config::SchedulerVersion, - deckconf::DeckConf, + deckconfig::DeckConfig, decks::DeckId, define_newtype, error::{AnkiError, FilteredDeckError, Result}, @@ -278,13 +278,13 @@ impl Collection { /// Get deck config for the given card. If missing, return default values. #[allow(dead_code)] - pub(crate) fn deck_config_for_card(&mut self, card: &Card) -> Result { + pub(crate) fn deck_config_for_card(&mut self, card: &Card) -> Result { if let Some(deck) = self.get_deck(card.original_or_current_deck_id())? { if let Some(conf_id) = deck.config_id() { return Ok(self.get_deck_config(conf_id, true)?.unwrap()); } } - Ok(DeckConf::default()) + Ok(DeckConfig::default()) } } diff --git a/rslib/src/deckconf/mod.rs b/rslib/src/deckconfig/mod.rs similarity index 94% rename from rslib/src/deckconf/mod.rs rename to rslib/src/deckconfig/mod.rs index 27cbb3b06..185ea401d 100644 --- a/rslib/src/deckconf/mod.rs +++ b/rslib/src/deckconfig/mod.rs @@ -28,7 +28,7 @@ use crate::{ define_newtype!(DeckConfId, i64); #[derive(Debug, PartialEq, Clone)] -pub struct DeckConf { +pub struct DeckConfig { pub id: DeckConfId, pub name: String, pub mtime_secs: TimestampSecs, @@ -36,9 +36,9 @@ pub struct DeckConf { pub inner: DeckConfigInner, } -impl Default for DeckConf { +impl Default for DeckConfig { fn default() -> Self { - DeckConf { + DeckConfig { id: DeckConfId(0), name: "".to_string(), mtime_secs: Default::default(), @@ -76,7 +76,7 @@ impl Default for DeckConf { } } -impl DeckConf { +impl DeckConfig { pub(crate) fn set_modified(&mut self, usn: Usn) { self.mtime_secs = TimestampSecs::now(); self.usn = usn; @@ -85,7 +85,7 @@ impl DeckConf { impl Collection { /// If fallback is true, guaranteed to return a deck config. - pub fn get_deck_config(&self, dcid: DeckConfId, fallback: bool) -> Result> { + pub fn get_deck_config(&self, dcid: DeckConfId, fallback: bool) -> Result> { if let Some(conf) = self.storage.get_deck_config(dcid)? { return Ok(Some(conf)); } @@ -94,7 +94,7 @@ impl Collection { return Ok(Some(conf)); } // if even the default deck config is missing, just return the defaults - Ok(Some(DeckConf::default())) + Ok(Some(DeckConfig::default())) } else { Ok(None) } @@ -104,7 +104,7 @@ impl Collection { impl Collection { pub(crate) fn add_or_update_deck_config( &mut self, - config: &mut DeckConf, + config: &mut DeckConfig, preserve_usn_and_mtime: bool, ) -> Result<()> { let usn = if preserve_usn_and_mtime { @@ -128,7 +128,7 @@ impl Collection { /// usn will be updated. pub(crate) fn add_deck_config_inner( &mut self, - config: &mut DeckConf, + config: &mut DeckConfig, usn: Option, ) -> Result<()> { if let Some(usn) = usn { @@ -142,8 +142,8 @@ impl Collection { /// and usn will be updated. pub(crate) fn update_deck_config_inner( &mut self, - config: &mut DeckConf, - original: DeckConf, + config: &mut DeckConfig, + original: DeckConfig, usn: Option, ) -> Result<()> { if config == &original { diff --git a/rslib/src/deckconf/schema11.rs b/rslib/src/deckconfig/schema11.rs similarity index 97% rename from rslib/src/deckconf/schema11.rs rename to rslib/src/deckconfig/schema11.rs index 7d15c9aae..05eebf215 100644 --- a/rslib/src/deckconf/schema11.rs +++ b/rslib/src/deckconfig/schema11.rs @@ -9,7 +9,7 @@ use serde_json::Value; use serde_repr::{Deserialize_repr, Serialize_repr}; use serde_tuple::Serialize_tuple; -use super::{DeckConf, DeckConfId, DeckConfigInner, NewCardOrder, INITIAL_EASE_FACTOR_THOUSANDS}; +use super::{DeckConfId, DeckConfig, DeckConfigInner, NewCardOrder, INITIAL_EASE_FACTOR_THOUSANDS}; use crate::{serde::default_on_invalid, timestamp::TimestampSecs, types::Usn}; #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] @@ -214,8 +214,8 @@ impl Default for DeckConfSchema11 { // schema11 -> schema15 -impl From for DeckConf { - fn from(mut c: DeckConfSchema11) -> DeckConf { +impl From for DeckConfig { + fn from(mut c: DeckConfSchema11) -> DeckConfig { // merge any json stored in new/rev/lapse into top level if !c.new.other.is_empty() { if let Ok(val) = serde_json::to_value(c.new.other) { @@ -238,7 +238,7 @@ impl From for DeckConf { serde_json::to_vec(&c.other).unwrap_or_default() }; - DeckConf { + DeckConfig { id: c.id, name: c.name, mtime_secs: c.mtime, @@ -280,8 +280,8 @@ impl From for DeckConf { } // latest schema -> schema 11 -impl From for DeckConfSchema11 { - fn from(c: DeckConf) -> DeckConfSchema11 { +impl From for DeckConfSchema11 { + fn from(c: DeckConfig) -> DeckConfSchema11 { // split extra json up let mut top_other: HashMap; let mut new_other = Default::default(); diff --git a/rslib/src/deckconf/undo.rs b/rslib/src/deckconfig/undo.rs similarity index 86% rename from rslib/src/deckconf/undo.rs rename to rslib/src/deckconfig/undo.rs index 6612524b9..cf14c8586 100644 --- a/rslib/src/deckconf/undo.rs +++ b/rslib/src/deckconfig/undo.rs @@ -6,9 +6,9 @@ use crate::prelude::*; #[derive(Debug)] pub(crate) enum UndoableDeckConfigChange { - Added(Box), - Updated(Box), - Removed(Box), + Added(Box), + Updated(Box), + Removed(Box), } impl Collection { @@ -29,7 +29,7 @@ impl Collection { } } - pub(crate) fn remove_deck_config_undoable(&mut self, config: DeckConf) -> Result<()> { + pub(crate) fn remove_deck_config_undoable(&mut self, config: DeckConfig) -> Result<()> { self.storage.remove_deck_conf(config.id)?; self.save_undo(UndoableDeckConfigChange::Removed(Box::new(config))); Ok(()) @@ -37,7 +37,7 @@ impl Collection { pub(super) fn add_deck_config_undoable( &mut self, - config: &mut DeckConf, + config: &mut DeckConfig, ) -> Result<(), AnkiError> { self.storage.add_deck_conf(config)?; self.save_undo(UndoableDeckConfigChange::Added(Box::new(config.clone()))); @@ -46,14 +46,14 @@ impl Collection { pub(super) fn update_deck_config_undoable( &mut self, - config: &DeckConf, - original: DeckConf, + config: &DeckConfig, + original: DeckConfig, ) -> Result<()> { self.save_undo(UndoableDeckConfigChange::Updated(Box::new(original))); self.storage.update_deck_conf(config) } - fn restore_deleted_deck_config(&mut self, config: DeckConf) -> Result<()> { + fn restore_deleted_deck_config(&mut self, config: DeckConfig) -> Result<()> { self.storage .add_or_update_deck_config_with_existing_id(&config)?; self.save_undo(UndoableDeckConfigChange::Added(Box::new(config))); diff --git a/rslib/src/deckconf/update.rs b/rslib/src/deckconfig/update.rs similarity index 98% rename from rslib/src/deckconf/update.rs rename to rslib/src/deckconfig/update.rs index 4ed942ba1..0f6912096 100644 --- a/rslib/src/deckconf/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -14,7 +14,7 @@ use crate::{ pub struct UpdateDeckConfigsIn { pub target_deck_id: DeckId, /// Deck will be set to last provided deck config. - pub configs: Vec, + pub configs: Vec, pub removed_config_ids: Vec, pub apply_to_children: bool, } @@ -28,7 +28,7 @@ impl Collection { Ok(pb::DeckConfigsForUpdate { all_config: self.get_deck_config_with_extra_for_update()?, current_deck: Some(self.get_current_deck_for_update(deck)?), - defaults: Some(DeckConf::default().into()), + defaults: Some(DeckConfig::default().into()), schema_modified: self .storage .get_collection_timestamps()? diff --git a/rslib/src/decks/tree.rs b/rslib/src/decks/tree.rs index dc71c46ee..c138ca18b 100644 --- a/rslib/src/decks/tree.rs +++ b/rslib/src/decks/tree.rs @@ -94,7 +94,7 @@ fn apply_limits( node: &mut DeckTreeNode, today: u32, decks: &HashMap, - dconf: &HashMap, + dconf: &HashMap, parent_limits: (u32, u32), ) { let (mut remaining_new, mut remaining_rev) = @@ -128,7 +128,7 @@ fn apply_limits_v2_old( node: &mut DeckTreeNode, today: u32, decks: &HashMap, - dconf: &HashMap, + dconf: &HashMap, parent_limits: (u32, u32), ) -> u32 { let original_rev_count = node.review_count; @@ -161,7 +161,7 @@ fn remaining_counts_for_deck( did: DeckId, today: u32, decks: &HashMap, - dconf: &HashMap, + dconf: &HashMap, ) -> (u32, u32) { if let Some(deck) = decks.get(&did) { match &deck.kind { @@ -355,7 +355,7 @@ impl Collection { #[cfg(test)] mod test { use super::*; - use crate::{collection::open_test_collection, deckconf::DeckConfId, error::Result}; + use crate::{collection::open_test_collection, deckconfig::DeckConfId, error::Result}; #[test] fn wellformed() -> Result<()> { diff --git a/rslib/src/lib.rs b/rslib/src/lib.rs index ff14467c6..eb5711ba5 100644 --- a/rslib/src/lib.rs +++ b/rslib/src/lib.rs @@ -12,7 +12,7 @@ pub mod cloze; pub mod collection; pub mod config; pub mod dbcheck; -pub mod deckconf; +pub mod deckconfig; pub mod decks; pub mod error; pub mod findreplace; diff --git a/rslib/src/notetype/cardgen.rs b/rslib/src/notetype/cardgen.rs index 8292462d6..396b83c34 100644 --- a/rslib/src/notetype/cardgen.rs +++ b/rslib/src/notetype/cardgen.rs @@ -11,7 +11,7 @@ use crate::{ card::{Card, CardId}, cloze::add_cloze_numbers_in_string, collection::Collection, - deckconf::{DeckConf, DeckConfId}, + deckconfig::{DeckConfId, DeckConfig}, decks::DeckId, error::{AnkiError, Result}, notes::{Note, NoteId}, @@ -56,7 +56,7 @@ pub(crate) struct CardGenContext<'a> { #[derive(Default)] pub(crate) struct CardGenCache { next_position: Option, - deck_configs: HashMap, + deck_configs: HashMap, } impl CardGenContext<'_> { @@ -318,8 +318,8 @@ impl Collection { let next_pos = cache.next_position.unwrap(); match cache.deck_configs.get(&did).unwrap().inner.new_card_order() { - crate::deckconf::NewCardOrder::Random => Ok(random_position(next_pos)), - crate::deckconf::NewCardOrder::Due => Ok(next_pos), + crate::deckconfig::NewCardOrder::Random => Ok(random_position(next_pos)), + crate::deckconfig::NewCardOrder::Due => Ok(next_pos), } } diff --git a/rslib/src/prelude.rs b/rslib/src/prelude.rs index 306e565f1..cea8fc89b 100644 --- a/rslib/src/prelude.rs +++ b/rslib/src/prelude.rs @@ -8,7 +8,7 @@ pub use crate::{ card::{Card, CardId}, collection::Collection, config::BoolKey, - deckconf::{DeckConf, DeckConfId}, + deckconfig::{DeckConfId, DeckConfig}, decks::{Deck, DeckId, DeckKind, NativeDeckName}, error::{AnkiError, Result}, i18n::I18n, diff --git a/rslib/src/scheduler/answering/mod.rs b/rslib/src/scheduler/answering/mod.rs index 3ddba4224..12ff5659b 100644 --- a/rslib/src/scheduler/answering/mod.rs +++ b/rslib/src/scheduler/answering/mod.rs @@ -21,7 +21,7 @@ use super::{ use crate::{ backend_proto, card::CardQueue, - deckconf::{DeckConf, LeechAction}, + deckconfig::{DeckConfig, LeechAction}, decks::Deck, prelude::*, }; @@ -50,7 +50,7 @@ pub struct CardAnswer { struct CardStateUpdater { card: Card, deck: Deck, - config: DeckConf, + config: DeckConfig, timing: SchedTimingToday, now: TimestampSecs, fuzz_seed: Option, @@ -275,7 +275,7 @@ impl Collection { self.update_queues_after_answering_card(&card, timing) } - fn maybe_bury_siblings(&mut self, card: &Card, config: &DeckConf) -> Result<()> { + fn maybe_bury_siblings(&mut self, card: &Card, config: &DeckConfig) -> Result<()> { if config.inner.bury_new || config.inner.bury_reviews { self.bury_siblings( card.id, @@ -356,7 +356,7 @@ impl Collection { &self, config_id: Option, home_deck_id: DeckId, - ) -> Result { + ) -> Result { let config_id = if let Some(config_id) = config_id { config_id } else { diff --git a/rslib/src/scheduler/answering/undo.rs b/rslib/src/scheduler/answering/undo.rs index 8d86d9bc2..8829419db 100644 --- a/rslib/src/scheduler/answering/undo.rs +++ b/rslib/src/scheduler/answering/undo.rs @@ -6,7 +6,7 @@ mod test { use crate::{ card::{CardQueue, CardType}, collection::open_test_collection, - deckconf::LeechAction, + deckconfig::LeechAction, prelude::*, scheduler::answering::{CardAnswer, Rating}, }; diff --git a/rslib/src/scheduler/learning.rs b/rslib/src/scheduler/learning.rs index 1878bb96b..e57763b57 100644 --- a/rslib/src/scheduler/learning.rs +++ b/rslib/src/scheduler/learning.rs @@ -3,7 +3,7 @@ use crate::{ card::{Card, CardQueue, CardType}, - deckconf::INITIAL_EASE_FACTOR_THOUSANDS, + deckconfig::INITIAL_EASE_FACTOR_THOUSANDS, }; impl Card { diff --git a/rslib/src/scheduler/queue/builder/mod.rs b/rslib/src/scheduler/queue/builder/mod.rs index 135ee962e..a6351ba52 100644 --- a/rslib/src/scheduler/queue/builder/mod.rs +++ b/rslib/src/scheduler/queue/builder/mod.rs @@ -19,7 +19,7 @@ use super::{ CardQueues, Counts, LearningQueueEntry, MainQueueEntry, MainQueueEntryKind, }; use crate::{ - deckconf::{NewCardOrder, ReviewCardOrder, ReviewMix}, + deckconfig::{NewCardOrder, ReviewCardOrder, ReviewMix}, prelude::*, }; diff --git a/rslib/src/scheduler/queue/limits.rs b/rslib/src/scheduler/queue/limits.rs index aa9d01ce4..9c23603cb 100644 --- a/rslib/src/scheduler/queue/limits.rs +++ b/rslib/src/scheduler/queue/limits.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use super::{Deck, DeckKind}; -use crate::deckconf::{DeckConf, DeckConfId}; +use crate::deckconfig::{DeckConfId, DeckConfig}; #[derive(Clone, Copy, Debug, PartialEq)] pub(crate) struct RemainingLimits { @@ -13,7 +13,7 @@ pub(crate) struct RemainingLimits { } impl RemainingLimits { - pub(crate) fn new(deck: &Deck, config: Option<&DeckConf>, today: u32) -> Self { + pub(crate) fn new(deck: &Deck, config: Option<&DeckConfig>, today: u32) -> Self { if let Some(config) = config { let (new_today, rev_today) = deck.new_rev_counts(today); RemainingLimits { @@ -36,7 +36,7 @@ impl RemainingLimits { pub(super) fn remaining_limits_capped_to_parents( decks: &[Deck], - config: &HashMap, + config: &HashMap, today: u32, ) -> Vec { let mut limits = get_remaining_limits(decks, config, today); @@ -48,7 +48,7 @@ pub(super) fn remaining_limits_capped_to_parents( /// the provided deck order. fn get_remaining_limits( decks: &[Deck], - config: &HashMap, + config: &HashMap, today: u32, ) -> Vec { decks diff --git a/rslib/src/scheduler/reviews.rs b/rslib/src/scheduler/reviews.rs index 7e4e06c23..4f7d32532 100644 --- a/rslib/src/scheduler/reviews.rs +++ b/rslib/src/scheduler/reviews.rs @@ -9,7 +9,7 @@ use crate::{ card::{Card, CardId, CardQueue, CardType}, collection::Collection, config::StringKey, - deckconf::INITIAL_EASE_FACTOR_THOUSANDS, + deckconfig::INITIAL_EASE_FACTOR_THOUSANDS, error::Result, prelude::*, }; diff --git a/rslib/src/scheduler/upgrade.rs b/rslib/src/scheduler/upgrade.rs index ae384d854..bbc8450be 100644 --- a/rslib/src/scheduler/upgrade.rs +++ b/rslib/src/scheduler/upgrade.rs @@ -63,7 +63,7 @@ impl Card { fn get_filter_info_for_card( card: &Card, decks: &HashMap, - configs: &HashMap, + configs: &HashMap, ) -> Option { if card.original_deck_id.0 == 0 { None diff --git a/rslib/src/storage/card/mod.rs b/rslib/src/storage/card/mod.rs index cc9d44bba..ea31ded2f 100644 --- a/rslib/src/storage/card/mod.rs +++ b/rslib/src/storage/card/mod.rs @@ -14,7 +14,7 @@ use rusqlite::{ use super::ids_to_string; use crate::{ card::{Card, CardId, CardQueue, CardType}, - deckconf::DeckConfId, + deckconfig::DeckConfId, decks::{Deck, DeckId, DeckKind}, error::Result, notes::NoteId, diff --git a/rslib/src/storage/deckconf/add.sql b/rslib/src/storage/deckconfig/add.sql similarity index 100% rename from rslib/src/storage/deckconf/add.sql rename to rslib/src/storage/deckconfig/add.sql diff --git a/rslib/src/storage/deckconf/add_or_update.sql b/rslib/src/storage/deckconfig/add_or_update.sql similarity index 100% rename from rslib/src/storage/deckconf/add_or_update.sql rename to rslib/src/storage/deckconfig/add_or_update.sql diff --git a/rslib/src/storage/deckconf/get.sql b/rslib/src/storage/deckconfig/get.sql similarity index 100% rename from rslib/src/storage/deckconf/get.sql rename to rslib/src/storage/deckconfig/get.sql diff --git a/rslib/src/storage/deckconf/mod.rs b/rslib/src/storage/deckconfig/mod.rs similarity index 91% rename from rslib/src/storage/deckconf/mod.rs rename to rslib/src/storage/deckconfig/mod.rs index 7ba7b3eaf..9026f5136 100644 --- a/rslib/src/storage/deckconf/mod.rs +++ b/rslib/src/storage/deckconfig/mod.rs @@ -9,13 +9,13 @@ use serde_json::Value; use super::SqliteStorage; use crate::{ - deckconf::{DeckConf, DeckConfId, DeckConfSchema11, DeckConfigInner}, + deckconfig::{DeckConfId, DeckConfSchema11, DeckConfig, DeckConfigInner}, prelude::*, }; -fn row_to_deckconf(row: &Row) -> Result { +fn row_to_deckconf(row: &Row) -> Result { let config = DeckConfigInner::decode(row.get_raw(4).as_blob()?)?; - Ok(DeckConf { + Ok(DeckConfig { id: row.get(0)?, name: row.get(1)?, mtime_secs: row.get(2)?, @@ -25,14 +25,14 @@ fn row_to_deckconf(row: &Row) -> Result { } impl SqliteStorage { - pub(crate) fn all_deck_config(&self) -> Result> { + pub(crate) fn all_deck_config(&self) -> Result> { self.db .prepare_cached(include_str!("get.sql"))? .query_and_then(NO_PARAMS, row_to_deckconf)? .collect() } - pub(crate) fn get_deck_config_map(&self) -> Result> { + pub(crate) fn get_deck_config_map(&self) -> Result> { self.db .prepare_cached(include_str!("get.sql"))? .query_and_then(NO_PARAMS, row_to_deckconf)? @@ -40,7 +40,7 @@ impl SqliteStorage { .collect() } - pub(crate) fn get_deck_config(&self, dcid: DeckConfId) -> Result> { + pub(crate) fn get_deck_config(&self, dcid: DeckConfId) -> Result> { self.db .prepare_cached(concat!(include_str!("get.sql"), " where id = ?"))? .query_and_then(params![dcid], row_to_deckconf)? @@ -48,7 +48,7 @@ impl SqliteStorage { .transpose() } - pub(crate) fn add_deck_conf(&self, conf: &mut DeckConf) -> Result<()> { + pub(crate) fn add_deck_conf(&self, conf: &mut DeckConfig) -> Result<()> { let mut conf_bytes = vec![]; conf.inner.encode(&mut conf_bytes)?; self.db @@ -67,7 +67,7 @@ impl SqliteStorage { Ok(()) } - pub(crate) fn update_deck_conf(&self, conf: &DeckConf) -> Result<()> { + pub(crate) fn update_deck_conf(&self, conf: &DeckConfig) -> Result<()> { let mut conf_bytes = vec![]; conf.inner.encode(&mut conf_bytes)?; self.db @@ -84,7 +84,10 @@ impl SqliteStorage { /// Used for syncing&undo; will keep provided ID. Shouldn't be used to add /// new config normally, since it does not allocate an id. - pub(crate) fn add_or_update_deck_config_with_existing_id(&self, conf: &DeckConf) -> Result<()> { + pub(crate) fn add_or_update_deck_config_with_existing_id( + &self, + conf: &DeckConfig, + ) -> Result<()> { if conf.id.0 == 0 { return Err(AnkiError::invalid_input("deck with id 0")); } @@ -119,7 +122,7 @@ impl SqliteStorage { // Creating/upgrading/downgrading pub(super) fn add_default_deck_config(&self, tr: &I18n) -> Result<()> { - let mut conf = DeckConf::default(); + let mut conf = DeckConfig::default(); conf.id.0 = 1; conf.name = tr.deck_config_default_name().into(); self.add_deck_conf(&mut conf) @@ -180,7 +183,7 @@ impl SqliteStorage { pub(super) fn upgrade_deck_conf_to_schema15(&self) -> Result<()> { for conf in self.all_deck_config_schema14()? { - let mut conf: DeckConf = conf.into(); + let mut conf: DeckConfig = conf.into(); // schema 15 stored starting ease of 2.5 as 250 conf.inner.initial_ease *= 100.0; self.update_deck_conf(&conf)?; diff --git a/rslib/src/storage/deckconf/update.sql b/rslib/src/storage/deckconfig/update.sql similarity index 100% rename from rslib/src/storage/deckconf/update.sql rename to rslib/src/storage/deckconfig/update.sql diff --git a/rslib/src/storage/mod.rs b/rslib/src/storage/mod.rs index 0ded5336d..3886f078b 100644 --- a/rslib/src/storage/mod.rs +++ b/rslib/src/storage/mod.rs @@ -5,7 +5,7 @@ pub(crate) mod card; mod collection_timestamps; mod config; mod deck; -mod deckconf; +mod deckconfig; mod graves; mod note; mod notetype; diff --git a/rslib/src/sync/mod.rs b/rslib/src/sync/mod.rs index 3069ad30d..6d33ecf4c 100644 --- a/rslib/src/sync/mod.rs +++ b/rslib/src/sync/mod.rs @@ -18,7 +18,7 @@ pub(crate) use server::{LocalServer, SyncServer}; use crate::{ backend_proto::{sync_status_out, SyncStatusOut}, card::{Card, CardQueue, CardType}, - deckconf::DeckConfSchema11, + deckconfig::DeckConfSchema11, decks::DeckSchema11, error::{SyncError, SyncErrorKind}, notes::Note, @@ -1200,7 +1200,7 @@ mod test { use super::{server::LocalServer, *}; use crate::{ - collection::open_collection, deckconf::DeckConf, decks::DeckKind, i18n::I18n, log, + collection::open_collection, deckconfig::DeckConfig, decks::DeckKind, i18n::I18n, log, notetype::all_stock_notetypes, search::SortMode, }; @@ -1374,7 +1374,7 @@ mod test { let mut deck = col1.get_or_create_normal_deck("new deck")?; // give it a new option group - let mut dconf = DeckConf { + let mut dconf = DeckConfig { name: "new dconf".into(), ..Default::default() }; diff --git a/rslib/src/undo/changes.rs b/rslib/src/undo/changes.rs index 2cd651d7a..4127c53f2 100644 --- a/rslib/src/undo/changes.rs +++ b/rslib/src/undo/changes.rs @@ -3,7 +3,7 @@ use crate::{ card::undo::UndoableCardChange, collection::undo::UndoableCollectionChange, - config::undo::UndoableConfigChange, deckconf::undo::UndoableDeckConfigChange, + config::undo::UndoableConfigChange, deckconfig::undo::UndoableDeckConfigChange, decks::undo::UndoableDeckChange, notes::undo::UndoableNoteChange, prelude::*, revlog::undo::UndoableRevlogChange, scheduler::queue::undo::UndoableQueueChange, tags::undo::UndoableTagChange,