{% extends 'base.html' %}
{% block head %}
<link rel="stylesheet" href="../css/plagiarism-checking-results.css" />
{% endblock %}
{% block content %}
<div class="header">
    <a class="grading-configuration-container" href="plagiarism-configuration1.html">
        <img src="../images/header-bg-long.png" />
        <div class="grading-configuration-text">
            <p>Plagiarism</p>
            <p>Configuration</p>
        </div>
    </a>

</div>

<div class="container">
    <div class="main-container">
        <table>
            <tr>
                <th>Homework 1 Name</th>
                <th>Homework 2 Name</th>
                <th>Similarity Score</th>
            </tr>
        </table>
        <div class="table-scroll">
            <table class="table-content">

            </table>

        </div>
    </div>
</div>

<div class="footer">

    <a class="grading-container" href="#">
        <img src="../images/create_assignment_bg_export.png" />
        <p>Export</p>
    </a>
</div>


<script>
$(document).ready(async function () {
    let results = await eel.autograder_plagiarism()();
    console.log(results);
    let output = "";
    for (let file of results.results) {
        output += `<tr>
                    <td>${file["student1"]} </td>
                    <td>${file["student2"]} </td>
                    <td>${(file["similarity_score"] * 100).toFixed(3)}%</td>
                </tr>
                `;
    }
    $(".table-content").html(output);
});

</script>
{% endblock %}