Fsrs #12
No files matched your search
Generated
+122
-2
@@ -1003,7 +1003,7 @@ dependencies = [
|
||||
"ciborium",
|
||||
"clap",
|
||||
"criterion-plot",
|
||||
"itertools",
|
||||
"itertools 0.13.0",
|
||||
"num-traits",
|
||||
"oorandom",
|
||||
"page_size",
|
||||
@@ -1023,7 +1023,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
|
||||
dependencies = [
|
||||
"cast",
|
||||
"itertools",
|
||||
"itertools 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1529,6 +1529,23 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||
|
||||
[[package]]
|
||||
name = "fsrs"
|
||||
version = "6.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8a99ea3dec9af37c9ed3835463ff6820a578a0026a8e370b4c1c0db48dfab3f"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"log",
|
||||
"ndarray",
|
||||
"priority-queue",
|
||||
"rand",
|
||||
"rayon",
|
||||
"serde",
|
||||
"snafu",
|
||||
"strum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.31"
|
||||
@@ -2411,6 +2428,15 @@ dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.17"
|
||||
@@ -2425,6 +2451,7 @@ dependencies = [
|
||||
"criterion",
|
||||
"dirs",
|
||||
"env_logger",
|
||||
"fsrs",
|
||||
"hashbrown 0.17.1",
|
||||
"hex",
|
||||
"iced",
|
||||
@@ -2775,6 +2802,16 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matrixmultiply"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.0"
|
||||
@@ -2911,6 +2948,21 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndarray"
|
||||
version = "0.17.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
|
||||
dependencies = [
|
||||
"matrixmultiply",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk"
|
||||
version = "0.9.0"
|
||||
@@ -2960,6 +3012,15 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.2.2"
|
||||
@@ -3772,6 +3833,17 @@ dependencies = [
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "priority-queue"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93980406f12d9f8140ed5abe7155acb10bb1e69ea55c88960b9c2f117445ef96"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"indexmap",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.4.0"
|
||||
@@ -3950,6 +4022,12 @@ version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
|
||||
|
||||
[[package]]
|
||||
name = "rawpointer"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.12.0"
|
||||
@@ -4715,6 +4793,27 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snafu"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e45cb604038abb7b926b679887b3226d8d0f23874b66623625a0454be425a4b7"
|
||||
dependencies = [
|
||||
"snafu-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snafu-derive"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "287f59010008f0d7cf5e3b03196d666c1acc46c8d3e9cf34c28a1a7157601e72"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.3"
|
||||
@@ -4804,6 +4903,27 @@ dependencies = [
|
||||
"float-cmp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
|
||||
+2
-1
@@ -26,13 +26,14 @@ rayon = "1.12.0"
|
||||
parking_lot = "0.12.5"
|
||||
env_logger = "0.11.11"
|
||||
log = "0.4.34"
|
||||
fsrs = "6.6.1"
|
||||
|
||||
[profile.super-release]
|
||||
inherits = "release"
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = 3
|
||||
strip = true
|
||||
#strip = true
|
||||
panic = "abort"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
+5
-1
@@ -9,5 +9,9 @@ create table card_stats
|
||||
references card_set
|
||||
on delete cascade,
|
||||
score INTEGER default 1 not null,
|
||||
last_opened INTEGER not null
|
||||
last_opened INTEGER not null,
|
||||
added INTEGER not null,
|
||||
fsrs_opened INTEGER,
|
||||
fsrs_memory INTEGER,
|
||||
fsrs_open_time INTEGER
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
create table history
|
||||
(
|
||||
id INTEGER
|
||||
primary key autoincrement,
|
||||
set_id INTEGER not null references card_set on delete cascade,
|
||||
stat_id INTEGER not null references card_stats on delete cascade,
|
||||
timestamp INTEGER not null,
|
||||
answer INTEGER not null,
|
||||
before INTEGER not null,
|
||||
after INTEGER not null
|
||||
);
|
||||
@@ -4,11 +4,16 @@ use crate::data::entities::HistoryItem;
|
||||
use crate::fs::*;
|
||||
use crate::notification::NotificationData::PermissionDenied;
|
||||
use crate::notification::{MaybeError, NotificationData};
|
||||
use chrono::DateTime;
|
||||
use chrono::{DateTime, NaiveDate};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::path::PathBuf;
|
||||
use rusqlite::Connection;
|
||||
|
||||
pub fn get_open_count_of_set(id: Id, connection: &Connection) -> Result<Vec<(NaiveDate, u32)>, NotificationData>{
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn get_history_of_set(id: Id) -> Result<Vec<HistoryItem>, NotificationData> {
|
||||
let app_dir = history_dir()?;
|
||||
|
||||
@@ -20,6 +20,7 @@ fn create_tables(conn: &Connection) {
|
||||
make_word_group(conn).expect("Failed to init table");
|
||||
make_words(conn).expect("Failed to init table");
|
||||
make_card_stats(conn).expect("Failed to init table");
|
||||
make_history(conn).expect("Failed to init table");
|
||||
}
|
||||
|
||||
fn make_settings(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||
@@ -51,6 +52,12 @@ fn make_card_stats(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn make_history(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||
let query = include_str!("../../sql/history.sql");
|
||||
conn.execute(query, ())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn default_connection() -> Connection {
|
||||
let db_file = db_path();
|
||||
let connection = Connection::open(db_file).expect("Failed to open database");
|
||||
|
||||
Reference in new issue
Block a user