mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
export revlogs where the rating is between 1 and 4 for research (#3524)
This commit is contained in:
parent
5caeac530e
commit
9a44881121
2 changed files with 12 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"))?
|
||||
|
|
Loading…
Reference in a new issue