-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
refactor: Convert Sched to Kotlin #12301
Conversation
com.ichi2.libanki.sched.Sched
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some minor cleanups.
bb98a75
to
bb026c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably missed some cleanup, this class is incredibly long. (And I plead guilty for part of it)
Still, I believe a bunch of cleanup that may improve code eventually
if (!TextUtils.isEmpty(p)) { | ||
Integer[] parentLims = lims.get(Decks.normalizeName(p)); | ||
val parentLims = lims[Decks.normalizeName(p)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider putting the !! here, to make clear that it's directly non null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the Assert
below
List<Long> ids = getCol().findCards(search, orderLimit); | ||
private fun _fillDyn(deck: Deck): List<Long> { | ||
val terms = deck.getJSONArray("terms").getJSONArray(0) | ||
var search = terms.getString(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KotlinCleanup: transform this into val
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks libAnki
compat
// update interval | ||
card.setLastIvl(card.getIvl()); | ||
card.lastIvl = card.ivl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KotlinCleanup: Either card.apply
or even define it as Card._rescheduleRev
.
Same for other methods rescheduling cards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks libAnki
compat
com.ichi2.libanki.sched.Sched
bb026c8
to
df4b952
Compare
I don't recommend expending much effort on this file, since reviewing with the v1 scheduler is no longer possible since #11808 |
Agreed, just want to get to 0% Java so we can cut down the excess code and hopefully reduce compile times |
Merged. If we don't care about cleanup because the code will disappear, no need to wait for the cleanup |
No description provided.