open-spaced-repetition / py-fsrs

Python Package for FSRS
https://pypi.org/project/fsrs/
MIT License
147 stars 23 forks source link

fsrs.repeat会导致输入的card信息被修改 #4

Closed ishiko732 closed 1 year ago

ishiko732 commented 1 year ago

test.py中: https://github.com/open-spaced-repetition/py-fsrs/blob/464543779f7e8ebaca18697cdf84fe8cd0dc766d/tests/test_fsrs.py#L26-L31

在29行开始做修改:

    card = scheduling_cards[Rating.Good].card
    good_card = card
    print(good_card.__dict__)
    now = card.due
    scheduling_cards = f.repeat(card, now)
    print(good_card.__dict__)

打印的结果发生改变: image

应当在fsrs.pyrepeat添加card = copy.deepcopy(card):

    def repeat(self, card: Card, now: datetime) -> dict[int, SchedulingInfo]:
        card = copy.deepcopy(card)
        if card.state == State.New:
L-M-Sherlock commented 1 year ago

OK 明天修一下