    /**
        * marks.js by @guateapps.
        * Copyright 2022 Guate Apps.
    */

    'use strict';
    
    function calcAverage(object)
    {
        var thisDiv = $(object).parents("tr");
        var prom = 0;
        var inputs = $(thisDiv).find('input[type=number]');
        var inFild = $(thisDiv).find('span');
        var dataID = $(inFild).data("id");
        inputs.each(function() {
            prom += Number(this.value);
        });
        var avgP = (Number(prom)/Number(inputs.length)).toFixed(2);
        $('#avg_'+dataID).text(avgP);
        $('#final_avg_'+dataID).val(avgP);
        $('#mark_obtained_'+dataID).val(prom);
    }

    $("#filter").on("keyup", function() {
        var filter = $(this).val();
        $('#results .altRow').each(function() {
            if ($(this).text().search(new RegExp(filter, "i")) < 0) {
                $(this).hide();
            } else {
                $(this).show();
 
            }
        });
    });