mirror of
https://github.com/ankitects/anki.git
synced 2026-01-07 02:53:54 -05:00
Added: Respect "Show remaining count"
This commit is contained in:
parent
3dba3580a7
commit
e663eeb454
2 changed files with 19 additions and 2 deletions
|
|
@ -399,7 +399,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
if let Some(answer) = req.answer {
|
||||
self.answer_card(&mut answer.into())?;
|
||||
}
|
||||
let queue = self.get_queued_cards(1, false)?;
|
||||
let mut queue = self.get_queued_cards(1, false)?;
|
||||
let next_card = queue.cards.first();
|
||||
if let Some(next_card) = next_card {
|
||||
let cid = next_card.card.id;
|
||||
|
|
@ -408,6 +408,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
|
||||
let render = self.render_existing_card(cid, false, true)?;
|
||||
let show_due = self.get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons);
|
||||
let show_remaning = self.get_config_bool(BoolKey::ShowRemainingDueCountsInStudy);
|
||||
|
||||
let answer_buttons = self
|
||||
.describe_next_states(&next_card.states)?
|
||||
|
|
@ -470,6 +471,12 @@ impl crate::services::SchedulerService for Collection {
|
|||
|
||||
let marked = note.tags.contains(&"marked".to_string());
|
||||
|
||||
if !show_remaning {
|
||||
queue.learning_count = 0;
|
||||
queue.review_count = 0;
|
||||
queue.new_count = 0;
|
||||
}
|
||||
|
||||
Ok(NextCardDataResponse {
|
||||
next_card: Some(NextCardData {
|
||||
queue: Some(queue.into()),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
const answerShown = state.answerShown;
|
||||
|
||||
$: button_count = $answerShown ? $answerButtons.length : 1;
|
||||
$: cardData = state.cardData;
|
||||
$: remainingShown =
|
||||
($cardData?.queue?.learningCount ?? 0) +
|
||||
($cardData?.queue?.reviewCount ?? 0) +
|
||||
($cardData?.queue?.newCount ?? 0) >
|
||||
0;
|
||||
</script>
|
||||
|
||||
<div id="outer" class="fancy">
|
||||
|
|
@ -35,7 +41,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
<AnswerButton {state} info={answerButton}></AnswerButton>
|
||||
{/each}
|
||||
{:else}
|
||||
<Remaining {state}></Remaining>
|
||||
{#if remainingShown}
|
||||
<Remaining {state}></Remaining>
|
||||
{:else}
|
||||
<span> </span>
|
||||
{/if}
|
||||
<button on:click={() => state.showAnswer()}>
|
||||
{tr.studyingShowAnswer()}
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue