mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12: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,7 +23,6 @@ impl GraphsContext {
|
||||||
pub(super) fn stability(&self) -> Intervals {
|
pub(super) fn stability(&self) -> Intervals {
|
||||||
let mut data = Intervals::default();
|
let mut data = Intervals::default();
|
||||||
for card in &self.cards {
|
for card in &self.cards {
|
||||||
if matches!(card.ctype, CardType::Review | CardType::Relearn) {
|
|
||||||
if let Some(state) = &card.memory_state {
|
if let Some(state) = &card.memory_state {
|
||||||
*data
|
*data
|
||||||
.intervals
|
.intervals
|
||||||
|
@ -31,7 +30,6 @@ impl GraphsContext {
|
||||||
.or_insert_with(Default::default) += 1;
|
.or_insert_with(Default::default) += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,9 @@ function makeSm2Query(start: number, end: number): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeFsrsQuery(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 fromQuery = `"prop:s>=${start - 0.5}"`;
|
||||||
const tillQuery = `"prop:s<${end + 0.5}"`;
|
const tillQuery = `"prop:s<${end + 0.5}"`;
|
||||||
return `${fromQuery} ${tillQuery}`;
|
return `${fromQuery} ${tillQuery}`;
|
||||||
|
@ -120,8 +123,8 @@ export function prepareIntervalData(
|
||||||
|
|
||||||
xMax = xMax! + 1;
|
xMax = xMax! + 1;
|
||||||
|
|
||||||
// do not show the zero interval
|
// do not show the zero interval for intervals
|
||||||
const increment = (x: number): number => x + 1;
|
const increment = fsrs ? x => x : (x: number): number => x + 1;
|
||||||
|
|
||||||
const adjustTicks = (x: number, idx: number, ticks: number[]): number[] =>
|
const adjustTicks = (x: number, idx: number, ticks: number[]): number[] =>
|
||||||
idx === ticks.length - 1 ? [x - (ticks[0] - 1), x + 1] : [x - (ticks[0] - 1)];
|
idx === ticks.length - 1 ? [x - (ticks[0] - 1), x + 1] : [x - (ticks[0] - 1)];
|
||||||
|
|
Loading…
Reference in a new issue