Skip to content

Commit

Permalink
Merge pull request #144 from abdnh/fix-overdue
Browse files Browse the repository at this point in the history
Fix sorting by overdue interval
  • Loading branch information
AnKingMed authored Sep 27, 2022
2 parents 26fa26a + fc03f5e commit d3b87cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions advancedbrowser/advancedbrowser/advanced_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,19 @@ def cOverdueIvl(c, n, t):
if val:
return mw.col.format_timespan(val * 24 * 60 * 60, context=FormatTimeSpanContext.INTERVALS)


srt = (f"""
select
(select
(case
when odid then null
when queue = {QUEUE_TYPE_LRN} then null
when queue = {QUEUE_TYPE_NEW} then null
when type = {CARD_TYPE_NEW} then null
when {mw.col.sched.today} - due <= 0 then null
when (queue = {QUEUE_TYPE_REV} or queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} or (type = {CARD_TYPE_REV} and queue < 0)) then ({mw.col.sched.today} - due)
end
)
where id = c.id asc nulls last""")
from cards where id = c.id) asc nulls last""")

cc = advBrowser.newCustomColumn(
type='coverdueivl',
Expand Down

0 comments on commit d3b87cd

Please # to comment.