<!doctype html>
<title>{{COURSE}} - Techela in a flask</title>
<head>
<script type="text/javascript" src="{{url_for('static', filename='jquery-latest.js')}}/"></script>
<script type="text/javascript" src="{{url_for('static', filename='jquery.tablesorter.js')}}"></script>

<script>
  $(document).ready(function()
    {
        $("#grades").tablesorter({widgets:['zebra'], sortList:[[5, 0]]});
    }
  );
</script>

<link rel="stylesheet" href="{{url_for('static', filename='themes/blue/style.css')}}" type="text/css" media="print, projection, screen" />


</head>

<h1>{{COURSE}} - Gradesheet for {{ label }}</h1>
<a href="/admin">admin</a> <a href="/">Home</a>

<a href="/return-all/{{ label }}">Return all assignments.</a>
<br><br>
<img src="data:image/png;base64,{{histogram}}">
<br>

<a href="/open-for-grading/{{label}}">Open 5 notebooks to grade</a>
<br>
<table id="grades" border="1" class=tablesorter>
  <thead>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Andrew ID</th>
    <th>File</th>
    <th>Turned in</th>
    <th>Grade</th>
    <th></th>
    <th>Returned</th>
  </thead>
  <tbody>
  {% for d in grade_data %}
  <tr>
    <td>{{d['first-name']}}</td>
    <td>{{d['last-name']}}</td>
    <td><a title="Click to send email" href="mailto:{{d['andrewid']}}@andrew.cmu.edu">{{d['andrewid']}}</a></td>
    {% if exists(d['filename']) %}
    <td><a href="/grade/{{ d['andrewid'] }}/{{ label }}">{{d['andrewid']}}-{{d['label']}}.ipynb</a></td>
    <td>{{d['turned-in']}}</td>
    {% if d['grade'] %}
    <td align="center">{{d['grade']|round(3)}}</td>
    {% else %}
    <td align="center">{{d['grade']}}</td>
    {% endif %}
    {% if d['grade'] %}
    <td><a href="/return/{{ d['andrewid'] }}/{{ label }}?force=True">Return</a></td>
    <td>{{d['returned']}}</td>
    {% else %}
    <td></td>
    <td></td>
    {% endif %}
    {% else %}
    <td><font color="red">{{d['andrewid']}}-{{d['label']}}.ipynb is missing.</font></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    {% endif %}
      </tr>
  {% endfor %}
  </tbody>
</table>
