<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Copy Detection Report</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
  <link rel="stylesheet" href="{{ style_path }}">
</head>
<body>
<div class="container" style="margin-top: 3em; max-width: 1400px">
  <h1 style="margin-bottom: 1em;">Copy Detection Report</h1>
  <h2>Overview</h2>
    <div class="container d-flex justify-content-center">
      <div class="col">
        <h4 style="text-align: center;">Similarity Matrix</h4>
        <img src="figures/sim_matrix.png" alt="Code similarity matrix">
      </div class="col">
      <div class="col">
        <h4 style="text-align: center;">Similarity Score Distribution</h4>
        <img src="figures/sim_histogram.png" alt="Code similarity histogram">
      </div class="col">
    </div>
    <p style="text-align: center">
      <i>Note: a score of -1 in the similarity matrix indicates the comparison was skipped</i>
    </p>
    <p>
    Number of files tested: {{ test_count }}<br>
    Number of reference files: {{ compare_count }}<br>
    Test files above display threshold: {{ flagged_file_count }} ({{ "%.2f"|format(flagged_file_count/test_count*100) }}%)<br><br>
    </p>

  <h2>Matched Code</h2>
  <table class="table table-striped table-sm">
  <tbody class="table-light">
  {% for code in code_list %}
  <tr>
  <td style="text-align: center;">
  <p>
    Test file: <i>{{ code[2] }}</i> (<b>{{ "%.2f"|format(code[0]*100) }}%</b>)<br>
    Reference file: <i>{{ code[3] }}</i> (<b>{{ "%.2f"|format(code[1]*100) }}%</b>)<br>
    Token overlap: {{ code[6] }}<br><br>
    <button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#collapse-{{loop.index}}" aria-expanded="false" aria-controls="collapse-{{loop.index}}">
      View matched code
    </button>
  </p>
  <div class="collapse" id="collapse-{{loop.index}}">
    <div class="card card-body">
      <div class="row">
        <div class="col" style="max-width: 600px">
          <pre><code>{{ code[4] }}</code></pre>
        </div>
        <div class="col" style="max-width: 600px">
          <pre><code>{{ code[5] }}</code></pre>
        </div>
      </div>
    </div>
  </div>
  </td>
  </tr>
  {% endfor %}
  </tbody>
  </table>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
