mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 00:12:25 -04:00
Fix a corner-case where due dates were shifted by a day
This issue existed in the old Python code as well. We need to include the user's UTC offset in the exported file, or days_elapsed falls back on the v1 cutoff calculation, which may be a day earlier or later than the v2 calculation.
This commit is contained in:
parent
308c663233
commit
a4dfad565d
2 changed files with 3 additions and 0 deletions
|
@ -27,6 +27,7 @@ pub(super) struct ExchangeData {
|
|||
pub(super) deck_configs: Vec<DeckConfig>,
|
||||
pub(super) media_paths: HashSet<PathBuf>,
|
||||
pub(super) days_elapsed: u32,
|
||||
pub(super) creation_utc_offset: Option<i32>,
|
||||
}
|
||||
|
||||
impl ExchangeData {
|
||||
|
@ -37,6 +38,7 @@ impl ExchangeData {
|
|||
with_scheduling: bool,
|
||||
) -> Result<()> {
|
||||
self.days_elapsed = col.timing_today()?.days_elapsed;
|
||||
self.creation_utc_offset = col.get_creation_utc_offset();
|
||||
self.notes = col.gather_notes(search)?;
|
||||
self.cards = col.gather_cards()?;
|
||||
self.decks = col.gather_decks()?;
|
||||
|
|
|
@ -88,6 +88,7 @@ impl Collection {
|
|||
let mut temp_col = Collection::new_minimal(path)?;
|
||||
temp_col.insert_data(&data)?;
|
||||
temp_col.set_creation_stamp(self.storage.creation_stamp()?)?;
|
||||
temp_col.set_creation_utc_offset(data.creation_utc_offset)?;
|
||||
temp_col.close(Some(SchemaVersion::V11))?;
|
||||
|
||||
Ok(data)
|
||||
|
|
Loading…
Reference in a new issue