Skip to content

Commit

Permalink
hidden option: mini_card_stats_with_ord
Browse files Browse the repository at this point in the history
  • Loading branch information
ijgnd committed Dec 7, 2019
1 parent 1bd7a78 commit 8600bee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/cardstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ def mini_card_stats(card, p, showOD):
if showOD:
rows_mini_stats.insert(1, ("Overdue days: ", p.value_for_overdue + ' (' + p.overdue_percent + '%)' ))
return make_two_column_table(rows_mini_stats)


def mini_card_stats_with_ord(card, p, showOD):
"""mini_card_stats is called for current and prior card. Overdue days doesn't make sense
for recently rated cards. So there needs to be an option to hide it. """
right_column = p.card_ivl_str + ' (scheduled)'
clickable_cid = '''<a href=# onclick="return pycmd('%s')">%s</a>''' %(
"BrowserSearch#" + str(p.c_CardID), str(p.c_CardID))
rows_mini_stats = [
("Ivl", right_column),
# ("sched Ivl",p.card_ivl_str),
# ("actual Ivl",p.card_ivl_str),
("Due day", p.dueday),
("cid/card created", clickable_cid + '&nbsp;&nbsp;--&nbsp;&nbsp;' + p.now),
("Template No.", p.c_ord),
("Deck(did)", p.c_Deck + ' (' + str(p.c_did) + ')'),
("Ease", p.c_Ease_str),
]
if showOD:
rows_mini_stats.insert(1, ("Overdue days: ", p.value_for_overdue + ' (' + p.overdue_percent + '%)' ))
return make_two_column_table(rows_mini_stats)


Expand Down
3 changes: 3 additions & 0 deletions src/sidebar_set_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .cardstats import (
card_stats_as_in_browser,
mini_card_stats,
mini_card_stats_with_ord
)
from .deckoptions import long_deck_options, text_for_short_options
from .schedulercomparison import text_for_scheduler_comparison
Expand Down Expand Up @@ -45,6 +46,8 @@ def update_contents_of_sidebar(self):

if gc('card_stats') == "detailed":
txt += card_stats_as_in_browser(card, p)
elif gc('card_stats') == "brief_with_ord":
txt += mini_card_stats_with_ord(card, p, True)
else:
txt += mini_card_stats(card, p, True)
txt += "<p>"
Expand Down

0 comments on commit 8600bee

Please sign in to comment.