Skip to content

Commit

Permalink
Fix/delta_t should be non-negative in history (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock authored Jul 18, 2024
1 parent 74444d3 commit b8293ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "FSRS-Optimizer"
version = "5.0.0"
version = "5.0.1"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down
6 changes: 4 additions & 2 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def cum_concat(x):
return list(accumulate(x))

t_history_list = df.groupby("card_id", group_keys=False)["delta_t"].apply(
lambda x: cum_concat([[int(i)] for i in x])
lambda x: cum_concat([[int(max(0, i))] for i in x])
)
df["t_history"] = [
",".join(map(str, item[:-1]))
Expand Down Expand Up @@ -1227,7 +1227,9 @@ def preview_sequence(self, test_rating_sequence: str, requestRetention: float):
(
f"{ivl}d"
if ivl < 30
else f"{ivl / 30:.1f}m" if ivl < 365 else f"{ivl / 365:.1f}y"
else f"{ivl / 30:.1f}m"
if ivl < 365
else f"{ivl / 365:.1f}y"
)
for ivl in map(int, t_history.split(","))
]
Expand Down

0 comments on commit b8293ef

Please sign in to comment.