use v2 scheduler+new timezone handling by default for new users
- In corner cases, enabling the new timezone handling later can cause reviews to shift forward or back a day, so it's best to have it on by default. - https://github.com/ankidroid/Anki-Android/issues/5805 has not landed in a stable release yet, but will hopefully not be too far off by the time 2.1.41 is released. - Existing users will be unaffected, as the upgrade prompt in the previous commit asks them if they use AnkiDroid. - Users starting on AnkiDroid will be unaffected, as their collections will still be on V1. - The error message AnkiWeb gives when syncing an older AnkiDroid with the new timezone enabled has been updated to direct users to the preferences screen.
This commit is contained in:
parent
5ae66af5d2
commit
8372931b9b
@ -13,6 +13,7 @@ def getEmptyCol():
|
||||
col = getEmptyColOrig()
|
||||
# only safe in test environment
|
||||
col.set_config("schedVer", 1)
|
||||
col._loadScheduler()
|
||||
return col
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ use slog::warn;
|
||||
/// new config variables, you do not need to add them here -
|
||||
/// just create an accessor function below with an appropriate
|
||||
/// default on missing/invalid values instead.
|
||||
pub(crate) fn schema11_config_as_string() -> String {
|
||||
pub(crate) fn schema11_config_as_string(creation_offset: Option<i32>) -> String {
|
||||
let obj = json!({
|
||||
"activeDecks": [1],
|
||||
"curDeck": 1,
|
||||
@ -33,7 +33,8 @@ pub(crate) fn schema11_config_as_string() -> String {
|
||||
"sortBackwards": false,
|
||||
"addToCur": true,
|
||||
"dayLearnFirst": false,
|
||||
"schedVer": 1,
|
||||
"schedVer": 2,
|
||||
"creationOffset": creation_offset,
|
||||
});
|
||||
serde_json::to_string(&obj).unwrap()
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
// Copyright: Ankitects Pty Ltd and contributors
|
||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
use crate::config::schema11_config_as_string;
|
||||
use crate::err::Result;
|
||||
use crate::err::{AnkiError, DBErrorKind};
|
||||
use crate::timestamp::{TimestampMillis, TimestampSecs};
|
||||
use crate::{config::schema11_config_as_string, sched::cutoff::local_minutes_west_for_stamp};
|
||||
use crate::{i18n::I18n, sched::cutoff::v1_creation_date, text::without_combining};
|
||||
use regex::Regex;
|
||||
use rusqlite::{functions::FunctionFlags, params, Connection, NO_PARAMS};
|
||||
@ -166,13 +166,18 @@ impl SqliteStorage {
|
||||
db.execute_batch(include_str!("schema11.sql"))?;
|
||||
// start at schema 11, then upgrade below
|
||||
let crt = v1_creation_date();
|
||||
let offset = if server {
|
||||
None
|
||||
} else {
|
||||
Some(local_minutes_west_for_stamp(crt))
|
||||
};
|
||||
db.execute(
|
||||
"update col set crt=?, scm=?, ver=?, conf=?",
|
||||
params![
|
||||
crt,
|
||||
TimestampMillis::now(),
|
||||
SCHEMA_STARTING_VERSION,
|
||||
&schema11_config_as_string()
|
||||
&schema11_config_as_string(offset)
|
||||
],
|
||||
)?;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user