{% extends "base.html" %}
{% block content %}
<div class="row">
    <div class="large-12 columns">
        {% if user.is_authenticated %}
        <h1>Your stats</h1>
        {% if not stats or stats.questions.total == 0 %}
        <p>No questions answered yet.</p>
        {% else %}
        <p>Total questions: {{stats.questions.total}}</p>
        <p>Correctly answered questions: {{stats.questions.correct}}</p>
        <p>Overall success rate: {{stats.questions.correct}}%</p>
        <p>Question history for last {{stats.mastery_size}} of each type:</p>
        <table>
            <tr>
                <td><b>Question Type</b></td>
                <td><b>Mastery</b></td>
                <td><b>History</b></td>
            </tr>
            {% for name, history in question_types.items %}
            <tr>
                <td>{{name}}</td>
                <td>{{history.mastery}}</td>
                <td>{{history.correct}}/{{history.total}}</td>
            </tr>
        {% endfor %}
        {% endif %}
        {% else %}
        <h1>mathquiz</h1>
        <a href="/accounts/register">Sign up</a> or <a href="/accounts/login">sign in</a> to start your math quiz!
        {% endif %}
    </div>
</div>
{% endblock %}

{% extends "base.html" %}
{% block content %}
<div class="row">
    <div class="large-12 columns">
        {% if user.is_authenticated %}
        <h1>Your stats</h1>
        {% if not stats or stats.questions.total == 0 %}
        <p>No questions answered yet.</p>
        {% else %}
        <p>Total questions: {{stats.questions.total}}</p>
        <p>Correctly answered questions: {{stats.questions.correct}}</p>
        <p>Overall success rate: {{stats.questions.success_rate}}%</p>
        <p>Question history for last {{stats.mastery_size}} of each type:</p>
        <table>
            <tr>
                <td><b>Question Type</b></td>
                <td><b>Mastery</b></td>
                <td><b>History</b></td>
            </tr>
            {% for name, history in question_types.items %}
            <tr>
                <td>{{name}}</td>
                <td>{{history.mastery}}</td>
                <td>{{history.correct}}/{{history.total}}</td>
            </tr>
        {% endfor %}
        {% endif %}
        {% else %}
        <h1>mathquiz</h1>
        <a href="/accounts/register">Sign up</a> or <a href="/accounts/login">sign in</a> to start your math quiz!
        {% endif %}
    </div>
</div>
{% endblock %}

Fix the display of success rate.
Fix the display of success rate.
