mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Handle stability < 0.5 in stability graph
This commit is contained in:
parent
02a5c2d526
commit
fb05e430c0
2 changed files with 10 additions and 9 deletions
|
@ -23,13 +23,11 @@ impl GraphsContext {
|
|||
pub(super) fn stability(&self) -> Intervals {
|
||||
let mut data = Intervals::default();
|
||||
for card in &self.cards {
|
||||
if matches!(card.ctype, CardType::Review | CardType::Relearn) {
|
||||
if let Some(state) = &card.memory_state {
|
||||
*data
|
||||
.intervals
|
||||
.entry(state.stability.round() as u32)
|
||||
.or_insert_with(Default::default) += 1;
|
||||
}
|
||||
if let Some(state) = &card.memory_state {
|
||||
*data
|
||||
.intervals
|
||||
.entry(state.stability.round() as u32)
|
||||
.or_insert_with(Default::default) += 1;
|
||||
}
|
||||
}
|
||||
data
|
||||
|
|
|
@ -78,6 +78,9 @@ function makeSm2Query(start: number, end: number): string {
|
|||
}
|
||||
|
||||
function makeFsrsQuery(start: number, end: number): string {
|
||||
if (start === 0) {
|
||||
start = 0.5;
|
||||
}
|
||||
const fromQuery = `"prop:s>=${start - 0.5}"`;
|
||||
const tillQuery = `"prop:s<${end + 0.5}"`;
|
||||
return `${fromQuery} ${tillQuery}`;
|
||||
|
@ -120,8 +123,8 @@ export function prepareIntervalData(
|
|||
|
||||
xMax = xMax! + 1;
|
||||
|
||||
// do not show the zero interval
|
||||
const increment = (x: number): number => x + 1;
|
||||
// do not show the zero interval for intervals
|
||||
const increment = fsrs ? x => x : (x: number): number => x + 1;
|
||||
|
||||
const adjustTicks = (x: number, idx: number, ticks: number[]): number[] =>
|
||||
idx === ticks.length - 1 ? [x - (ticks[0] - 1), x + 1] : [x - (ticks[0] - 1)];
|
||||
|
|
Loading…
Reference in a new issue