Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forget card to review context "more" menu #1642

Merged

Conversation

aracelix
Copy link
Contributor

@aracelix aracelix commented Feb 6, 2022

I hope I did this correctly. Development notes say that there is a transition from python to rust for the business logic - forgetting cards seems like business logic...what I did in this PR is reference forget_cards from scheduling.py in the context menu:

def forget_cards(
*, parent: QWidget, card_ids: Sequence[CardId]
) -> CollectionOp[OpChanges]:
return CollectionOp(
parent, lambda col: col.sched.schedule_cards_as_new(card_ids)
).success(
lambda _: tooltip(
tr.scheduling_forgot_cards(cards=len(card_ids)), parent=parent
)
)

Which looks like it eventually calls the rust backend?

def schedule_cards_as_new(self, card_ids: Sequence[CardId]) -> OpChanges:
"Put cards at the end of the new queue."
return self.col._backend.schedule_cards_as_new(card_ids=card_ids, log=True)

Re: tests, it seemed like there were tests for forget_cards already, but didn't see anything specifically for the review view. I did check that clicking the menu and using the shortcut both work to forget a card. Let me know if that's not enough/expected.

@dae
Copy link
Member

dae commented Feb 7, 2022

Thanks Araceli, that's exactly what I would have done, and as this is just hooking the GUI up to existing functionality, I don't think we need a test here. Most of the biz logic is implemented in Rust at this point, with import/export the last major remaining hurdle.

@dae dae merged commit 1e59ad6 into ankitects:main Feb 7, 2022
@zcorley24
Copy link

I'm sorry... but how in the world would do i get this to work? I've been looking for something like this forever!

I have python and VSCode but am still learning

Also thank you so much, even if i'm not able to use it i think it's so cool you have the ability to do this and also post it for everyone!

@dae
Copy link
Member

dae commented Jul 24, 2022

If you don't see it in your Anki, maybe you need to update it to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants