{% extends 'course-manage/layout.html.twig' %}

{% block title %}{{'随堂练习统计'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'question_marker' %}

{% do script(['app/js/course-manage/question-marker/index.js'])%}

{% block main %}
  <div class="panel panel-default panel-col course-data">
    <div class="panel-heading">
      {{ '随堂练习统计'|trans }}
    </div>
    <div class="panel-body dashboard-panel">
      <form class="form-inline well well-sm" action method="get">
        <div class="form-group ">
          <select class="form-control js-switch-lesson width-input-large" data-url="{{ path('course_manage_question_marker', {courseSetId:course.courseSetId, courseId:course.id}) }}">
            {% for task in stats.tasks %}
              <option value="{{ task.id }}" {% if task.id == stats.taskId %}selected="selected"{% endif %}>{{ task.title }}</option>
            {% else %}
              <option value="0">无任务</option>
            {% endfor %}
          </select>
        </div>
      </form>
      <table class="table table-hover table-striped">
        <thead>
        <tr>
          <th>时间点</th>
          <th width="32%" >题干</th>
          <th>参与人数</th>
          <th>答题次数</th>
          <th>正确次数</th>
          <th>正确率
            <span class="sort-operation js-sort-btn">
                <i class="es-icon es-icon-arrowdropup {% if app.request.query.get('order')=='asc' %} active {% endif %}" data-val="asc"></i>
                <i class="es-icon es-icon-arrowdropdown {% if app.request.query.get('order')=='desc' %} active {% endif %}" data-val="desc"></i>
              </span>
          </th>
          <th>操作</th>

        </tr>
        </thead>
        <tbody>
        {% for questionMarker in stats.questionMarkers %}
          <tr>
            <td>{{ questionMarker.markTime|duration }}</td>
            <td >{{ questionMarker.stem|fill_question_stem_text|raw|plain_text(40) }}</td>
            <td>{{ questionMarker.userNum }}</td>
            <td>{{ questionMarker.answerNum }}</td>
            <td>{{ questionMarker.rightNum }}</td>
            <td>{{ questionMarker.pct }}%</td>
            <td><a href="#modal" data-toggle="modal" data-url="{{ path('course_manage_question_marker_analysis', {courseSetId:course.courseSetId, courseId:course.id, taskId:stats.taskId, questionMarkerId:questionMarker.id}) }}">答题分布</a></td>
          </tr>
        {% else %}
          <tr ><td colspan="7"><div class="empty">该任务下无驻点弹题</div></td></tr>
        {% endfor %}
        </tbody>
      </table>
      <p class="text-sm">
        共计<span class="color-primary text-success pls prs">{{ stats.totalAnswerNum }}</span>次答题，<span class="color-primary pls prs">{{ stats.totalUserNum}}</span>人参与答题
      </p>
    </div>
  </div>
{% endblock %}