Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only export review logs where the rating is between 1 and 4 for research #3524

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rslib/src/scheduler/fsrs/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Collection {

/// Used for exporting revlogs for algorithm research.
pub fn export_dataset(&mut self, min_entries: usize, target_path: &Path) -> Result<()> {
let revlog_entries = self.storage.get_all_revlog_entries_in_card_order()?;
let revlog_entries = self.storage.get_revlog_entries_for_export_dataset()?;
if revlog_entries.len() < min_entries {
return Err(AnkiError::FsrsInsufficientData);
}
Expand Down
11 changes: 11 additions & 0 deletions rslib/src/storage/revlog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ impl SqliteStorage {
.collect()
}

pub(crate) fn get_revlog_entries_for_export_dataset(&self) -> Result<Vec<RevlogEntry>> {
self.db
.prepare_cached(concat!(
include_str!("get.sql"),
" where ease between 1 and 4",
" order by cid, id"
))?
.query_and_then([], row_to_revlog_entry)?
.collect()
}

pub(crate) fn get_all_revlog_entries_in_card_order(&self) -> Result<Vec<RevlogEntry>> {
self.db
.prepare_cached(concat!(include_str!("get.sql"), " order by cid, id"))?
Expand Down