Revert "use v2 scheduler+new timezone handling by default for new users"

This reverts commit 8372931b9b.

I fear this will be too disruptive - let's give AnkiDroid a bit more
time to catch up. Reverting this will mean new users are presented with
an upgrade notice on first startup, which looks a bit silly, but it's
probably the lesser of two evils.
This commit is contained in:
Damien Elmes 2021-02-21 19:03:46 +10:00
parent 73ddaf3c96
commit 53d9433d94
3 changed files with 4 additions and 11 deletions

View file

@ -13,7 +13,6 @@ def getEmptyCol():
col = getEmptyColOrig() col = getEmptyColOrig()
# only safe in test environment # only safe in test environment
col.set_config("schedVer", 1) col.set_config("schedVer", 1)
col._loadScheduler()
return col return col

View file

@ -18,7 +18,7 @@ use slog::warn;
/// new config variables, you do not need to add them here - /// new config variables, you do not need to add them here -
/// just create an accessor function below with an appropriate /// just create an accessor function below with an appropriate
/// default on missing/invalid values instead. /// default on missing/invalid values instead.
pub(crate) fn schema11_config_as_string(creation_offset: Option<i32>) -> String { pub(crate) fn schema11_config_as_string() -> String {
let obj = json!({ let obj = json!({
"activeDecks": [1], "activeDecks": [1],
"curDeck": 1, "curDeck": 1,
@ -33,8 +33,7 @@ pub(crate) fn schema11_config_as_string(creation_offset: Option<i32>) -> String
"sortBackwards": false, "sortBackwards": false,
"addToCur": true, "addToCur": true,
"dayLearnFirst": false, "dayLearnFirst": false,
"schedVer": 2, "schedVer": 1,
"creationOffset": creation_offset,
}); });
serde_json::to_string(&obj).unwrap() serde_json::to_string(&obj).unwrap()
} }

View file

@ -1,10 +1,10 @@
// Copyright: Ankitects Pty Ltd and contributors // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html // 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::Result;
use crate::err::{AnkiError, DBErrorKind}; use crate::err::{AnkiError, DBErrorKind};
use crate::timestamp::{TimestampMillis, TimestampSecs}; 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 crate::{i18n::I18n, sched::cutoff::v1_creation_date, text::without_combining};
use regex::Regex; use regex::Regex;
use rusqlite::{functions::FunctionFlags, params, Connection, NO_PARAMS}; use rusqlite::{functions::FunctionFlags, params, Connection, NO_PARAMS};
@ -166,18 +166,13 @@ impl SqliteStorage {
db.execute_batch(include_str!("schema11.sql"))?; db.execute_batch(include_str!("schema11.sql"))?;
// start at schema 11, then upgrade below // start at schema 11, then upgrade below
let crt = v1_creation_date(); let crt = v1_creation_date();
let offset = if server {
None
} else {
Some(local_minutes_west_for_stamp(crt))
};
db.execute( db.execute(
"update col set crt=?, scm=?, ver=?, conf=?", "update col set crt=?, scm=?, ver=?, conf=?",
params![ params![
crt, crt,
TimestampMillis::now(), TimestampMillis::now(),
SCHEMA_STARTING_VERSION, SCHEMA_STARTING_VERSION,
&schema11_config_as_string(offset) &schema11_config_as_string()
], ],
)?; )?;
} }