Skip to content

Commit

Permalink
Feat/type record log (#36)
Browse files Browse the repository at this point in the history
* Feat/typo RecordLog

* 3.0.4
  • Loading branch information
ishiko732 authored Oct 22, 2023
1 parent dc1be52 commit f76d2a1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-fsrs",
"version": "3.0.3",
"version": "3.0.4",
"description": "ts-fsrs is a TypeScript package used to implement the Free Spaced Repetition Scheduler (FSRS) algorithm. It helps developers apply FSRS to their flashcard applications, thereby improving the user learning experience.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/fsrs/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const default_w = envParams.FSRS_W || [
];
export const default_enable_fuzz = envParams.FSRS_ENABLE_FUZZ || false;

export const FSRSVersion: string = "3.0.3";
export const FSRSVersion: string = "3.0.4";

export const generatorParameters = (props?: Partial<FSRSParameters>) => {
return {
Expand Down
4 changes: 4 additions & 0 deletions src/fsrs/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export interface ReviewLog {
review: Date;
}

export type RecordLog = {
[key in Rating]: { card: Card; log: ReviewLog };
};

export interface Card {
due: Date;
stability: number; // 稳定性
Expand Down
4 changes: 2 additions & 2 deletions src/fsrs/scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, Rating, State } from "./models";
import { Card, Rating, RecordLog, State } from "./models";
import { date_scheduler } from "./help";

export class SchedulingCard {
Expand Down Expand Up @@ -62,7 +62,7 @@ export class SchedulingCard {
return this;
}

record_log(card: Card, now: Date) {
record_log(card: Card, now: Date): RecordLog {
return {
[Rating.Again]: {
card: this.again,
Expand Down

0 comments on commit f76d2a1

Please sign in to comment.