mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
no need to log card resets when exporting
This commit is contained in:
parent
83136d2491
commit
dad4c76089
4 changed files with 16 additions and 9 deletions
|
@ -1408,7 +1408,7 @@ and (queue={QUEUE_TYPE_NEW} or (queue={QUEUE_TYPE_REV} and due<=?))""",
|
||||||
|
|
||||||
def schedule_cards_as_new(self, card_ids: List[int]) -> None:
|
def schedule_cards_as_new(self, card_ids: List[int]) -> None:
|
||||||
"Put cards at the end of the new queue."
|
"Put cards at the end of the new queue."
|
||||||
self.col.backend.schedule_cards_as_new(card_ids)
|
self.col.backend.schedule_cards_as_new(card_ids=card_ids, log=True)
|
||||||
|
|
||||||
def schedule_cards_as_reviews(
|
def schedule_cards_as_reviews(
|
||||||
self, card_ids: List[int], min_interval: int, max_interval: int
|
self, card_ids: List[int], min_interval: int, max_interval: int
|
||||||
|
@ -1432,8 +1432,7 @@ and (queue={QUEUE_TYPE_NEW} or (queue={QUEUE_TYPE_REV} and due<=?))""",
|
||||||
" where id in %s" % sids
|
" where id in %s" % sids
|
||||||
)
|
)
|
||||||
# and forget any non-new cards, changing their due numbers
|
# and forget any non-new cards, changing their due numbers
|
||||||
self.forgetCards(nonNew)
|
self.col.backend.schedule_cards_as_new(card_ids=nonNew, log=False)
|
||||||
self.col.log(ids)
|
|
||||||
|
|
||||||
# legacy
|
# legacy
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ service BackendService {
|
||||||
rpc EmptyFilteredDeck (DeckID) returns (Empty);
|
rpc EmptyFilteredDeck (DeckID) returns (Empty);
|
||||||
rpc RebuildFilteredDeck (DeckID) returns (UInt32);
|
rpc RebuildFilteredDeck (DeckID) returns (UInt32);
|
||||||
rpc ScheduleCardsAsReviews (ScheduleCardsAsReviewsIn) returns (Empty);
|
rpc ScheduleCardsAsReviews (ScheduleCardsAsReviewsIn) returns (Empty);
|
||||||
rpc ScheduleCardsAsNew (CardIDs) returns (Empty);
|
rpc ScheduleCardsAsNew (ScheduleCardsAsNewIn) returns (Empty);
|
||||||
rpc SortCards (SortCardsIn) returns (Empty);
|
rpc SortCards (SortCardsIn) returns (Empty);
|
||||||
rpc SortDeck (SortDeckIn) returns (Empty);
|
rpc SortDeck (SortDeckIn) returns (Empty);
|
||||||
|
|
||||||
|
@ -1068,6 +1068,11 @@ message ScheduleCardsAsReviewsIn {
|
||||||
uint32 max_interval = 3;
|
uint32 max_interval = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ScheduleCardsAsNewIn {
|
||||||
|
repeated int64 card_ids = 1;
|
||||||
|
bool log = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message SortCardsIn {
|
message SortCardsIn {
|
||||||
repeated int64 card_ids = 1;
|
repeated int64 card_ids = 1;
|
||||||
uint32 starting_from = 2;
|
uint32 starting_from = 2;
|
||||||
|
|
|
@ -565,10 +565,11 @@ impl BackendService for Backend {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn schedule_cards_as_new(&self, input: pb::CardIDs) -> BackendResult<Empty> {
|
fn schedule_cards_as_new(&self, input: pb::ScheduleCardsAsNewIn) -> BackendResult<Empty> {
|
||||||
self.with_col(|col| {
|
self.with_col(|col| {
|
||||||
col.reschedule_cards_as_new(&input.into_native())
|
let cids: Vec<_> = input.card_ids.into_iter().map(CardID).collect();
|
||||||
.map(Into::into)
|
let log = input.log;
|
||||||
|
col.reschedule_cards_as_new(&cids, log).map(Into::into)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl NewCardSorter {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub fn reschedule_cards_as_new(&mut self, cids: &[CardID]) -> Result<()> {
|
pub fn reschedule_cards_as_new(&mut self, cids: &[CardID], log: bool) -> Result<()> {
|
||||||
let usn = self.usn()?;
|
let usn = self.usn()?;
|
||||||
let mut position = self.get_next_card_position();
|
let mut position = self.get_next_card_position();
|
||||||
self.transact(None, |col| {
|
self.transact(None, |col| {
|
||||||
|
@ -76,7 +76,9 @@ impl Collection {
|
||||||
let cards = col.storage.all_searched_cards_in_search_order()?;
|
let cards = col.storage.all_searched_cards_in_search_order()?;
|
||||||
for mut card in cards {
|
for mut card in cards {
|
||||||
let original = card.clone();
|
let original = card.clone();
|
||||||
col.log_manually_scheduled_review(&card, usn, 0)?;
|
if log {
|
||||||
|
col.log_manually_scheduled_review(&card, usn, 0)?;
|
||||||
|
}
|
||||||
card.schedule_as_new(position);
|
card.schedule_as_new(position);
|
||||||
col.update_card(&mut card, &original, usn)?;
|
col.update_card(&mut card, &original, usn)?;
|
||||||
position += 1;
|
position += 1;
|
||||||
|
|
Loading…
Reference in a new issue