<commit_before>#
# current_card.py <Peter.Bienstman<EMAIL>>
#

import time

from mnemosyne.libmnemosyne.translator import _
from mnemosyne.libmnemosyne.statistics_page import HtmlStatisticsPage

DAY = 24 * 60 * 60 # Seconds in a day.


class CurrentCard(HtmlStatisticsPage):

    name = _("Current card")
        
    def prepare_statistics(self, variant):
        card = self.review_controller().card
        self.html = """<html<body>
        <style type="text/css">
        table { height: 100%;
                margin-left: auto; margin-right: auto;
                text-align: center}
        body  { background-color: white;
                margin: 0;
                padding: 0;
                border: thin solid #8F8F8F; }
        </style></head><table><tr><td>"""
        if not card:
            self.html += _("No current card.")
        elif card.grade == -1:
            self.html += _("Unseen card, no statistics available yet.")
        else:
            self.html += _("Grade") + ": %d<br>" % card.grade
            self.html += _("Easiness") + ": %1.2f<br>" % card.easiness
            self.html += _("Repetitions") + ": %d<br>" \
                % (card.acq_reps + card.ret_reps)
            self.html += _("Lapses") + ": %d<br>" % card.lapses
            self.html += _("Interval") + ": %d<br>" \
                % (card.interval / DAY)
            self.html += _("Last repetition") + ": %s<br>" \
                % time.strftime("%B %d, %Y", time.gmtime(card.last_rep))           
            self.html += _("Next repetition") + ": %s<br>" \
                % time.strftime("%B %d, %Y", time.gmtime(card.next_rep))
            self.html += _("Average thinking time (secs)") + ": %d<br>" \
                % self.database().average_thinking_time(card)
            self.html += _("Total thinking time (secs)") + ": %d<br>" \<commit_msg>Fix unicode bug in date display.<commit_after>#
# current_card.py <<EMAIL>>
#

import time

from mnemosyne.libmnemosyne.translator import _
from mnemosyne.libmnemosyne.statistics_page import HtmlStatisticsPage

DAY = 24 * 60 * 60 # Seconds in a day.


class CurrentCard(HtmlStatisticsPage):

    name = _("Current card")
        
    def prepare_statistics(self, variant):
        card = self.review_controller().card
        self.html = """<html<body>
        <style type="text/css">
        table { height: 100%;
                margin-left: auto; margin-right: auto;
                text-align: center}
        body  { background-color: white;
                margin: 0;
                padding: 0;
                border: thin solid #8F8F8F; }
        </style></head><table><tr><td>"""
        if not card:
            self.html += _("No current card.")
        elif card.grade == -1:
            self.html += _("Unseen card, no statistics available yet.")
        else:
            self.html += _("Grade") + ": %d<br>" % card.grade
            self.html += _("Easiness") + ": %1.2f<br>" % card.easiness
            self.html += _("Repetitions") + ": %d<br>" \
                % (card.acq_reps + card.ret_reps)
            self.html += _("Lapses") + ": %d<br>" % card.lapses
            self.html += _("Interval") + ": %d<br>" \
                % (card.interval / DAY)
            self.html += _("Last repetition") + ": %s<br>" \
                % time.strftime("%B %d, %Y", time.gmtime(card.last_rep))\
                .decode('utf-8')           
            self.html += _("Next repetition") + ": %s<br>" \
                % time.strftime("%B %d, %Y", time.gmtime(card.next_rep))\
                .decode('utf-8')
            self.html += _("Average thinking time (secs)") + ": %d<br>" \
                % self.database().average_thinking_time(card)
            self.html += _("Total thinking time (secs)") + ": %d<br>" \
{'fraction_non_alphanumeric': 0.16604970914859862, 'fraction_numerical': 0.009518773135906928, 'mean_word_length': 1.8746200607902737, 'pattern_counts': {'":': 18, '<': 41, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2276208', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1167, 'n_words': 255}