diff --git a/Cargo.lock b/Cargo.lock index d29569d..5cb9dd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -726,7 +726,7 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "fsrs" -version = "1.1.4" +version = "1.3.3" dependencies = [ "burn", "chrono", @@ -735,6 +735,7 @@ dependencies = [ "log", "ndarray", "ndarray-rand", + "priority-queue", "rand", "rayon", "serde", @@ -1526,6 +1527,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" +[[package]] +name = "priority-queue" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714c75db297bc88a63783ffc6ab9f830698a6705aa0201416931759ef4c8183d" +dependencies = [ + "autocfg", + "equivalent", + "indexmap", +] + [[package]] name = "proc-macro2" version = "1.0.81" diff --git a/fsrs-rs b/fsrs-rs index ed628b0..8ef7197 160000 --- a/fsrs-rs +++ b/fsrs-rs @@ -1 +1 @@ -Subproject commit ed628b09c5889e870e70c01f89ac1526325583d8 +Subproject commit 8ef7197bec29470cf4ba612e8383f72eb7f4cfb6 diff --git a/sandbox/tests/prod.spec.ts b/sandbox/tests/prod.spec.ts index e8e1b13..9502ecb 100644 --- a/sandbox/tests/prod.spec.ts +++ b/sandbox/tests/prod.spec.ts @@ -1,4 +1,4 @@ -import { test, expect, Page } from '@playwright/test' +import { test, expect } from '@playwright/test' import { goHome } from './util' test('check memory state', async ({ page }) => { @@ -22,13 +22,16 @@ test('check memory state', async ({ page }) => { test('check next interval', async ({ page }) => { await goHome(page) await page.getByRole('button', { name: 'Calculate Next Interval' }).click() - await expect(page.locator('#nextIntervalResponse')).toHaveText('2') + await expect(page.locator('#nextIntervalResponse')).toContainText('.') // ensures that text has updated, so the more specific assertion `.toEqual(2)` can run + const nextInterval = await page.locator('#nextIntervalResponse').textContent() + const rounded = Math.round(parseFloat(nextInterval)) + expect(rounded).toEqual(2) }) test('check progress and parameters', async ({ page }) => { await goHome(page) await page.getByRole('button', { name: 'Train with example file' }).click() - let progress = await page.locator('#progressNumbers').innerText() + const progress = await page.locator('#progressNumbers').innerText() expect(progress).toEqual('0/0') await expect .poll( diff --git a/src/lib.rs b/src/lib.rs index 0e6d659..7600c71 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -131,7 +131,7 @@ impl FSRSwasm { stability: Option, desired_retention: f32, rating: u32, - ) -> u32 { + ) -> f32 { self.model .next_interval(stability, desired_retention, rating) }