<commit_before><html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:tal="http://xml.zope.org/namespaces/tal"
    xmlns:metal="http://xml.zope.org/namespaces/metal"
    xmlns:i18n="http://xml.zope.org/namespaces/i18n"
    metal:use-macro="here/main_template/macros/master"
    i18n:domain="bika">

<metal:slot fill-slot="head_slot">
    <style>
        #chart { text-align:center; white-space:nowrap; overflow:auto;height:300px;}
        .domain {
          fill: none;
          stroke: #3d3d3d;
          stroke-width: 1.5;
        }

    </style>
    <script>
        jQuery(function($){
            $(document).ready(function(){

                // Populate analyses selector
                var data = $.parseJSON($('#graphdata').val());
                var qcrec = false;
                $.map(data, function(value,key){
                    $('#selanalyses').append('<option value="'+key+'">'+key+'</option>');
                    if (qcrec == false) {
                        $.map(value, function(v, k) {
                            $('#selqcsample').append('<option value="'+k+'">'+k+'</option>');
                        });
                        qcrec = true;
                    }
                });

                $('#selanalyses').change(function(e) {
                    drawControlChart($(this).val(), $('#selqcsample').val(), $('#interpolation').val());
                });

                $('#selqcsample').change(function(e) {
                    drawControlChart($('#selanalyses').val(), $(this).val(), $('#interpolation').val());
                });

                $('#interpolation').change(function(e) {
                    drawControlChart($('#selanalyses').val(), $('#selqcsample').val(), $('#interpolation').val());
                });

                // Draw the chart
                drawControlChart($('#selanalyses option:first-child').val(), $('#selqcsample option:first-child').val(), $('#interpolation').val());

            });
        });

        function drawControlChart(analysiskey, reftype, interpolation) {
            if ($("#chart svg").length > 0) {
                $("#chart").css('height', $("#chart").innerHeight());
                $("#chart").css('width', $("#chart").innerWidth());
            }
            $("#chart").html("");
            $("#chart").show();
            var data = $.parseJSON($('#graphdata').val());
            data = data[analysiskey]
            if (!(reftype in data) || data[reftype].length == 0) {
                // There is no results for this type of refsample
                $("#chart").hide();
                return;
            }
            data = data[reftype];
            var unit = data[data.length-1]['unit'];
            var upper = data[data.length-1]['upper'];
            var lower = data[data.length-1]['lower'];
            var target = data[data.length-1]['target'];
            var ylabel = "Result";
            if (unit == '' || typeof unit == 'undefined') {
                unit = "";
            } else {
                ylabel = unit;
            }

            var uppertxt = $.trim("UCL (" + upper+""+unit+")");
            var lowertxt = $.trim("LCL (" + lower+""+unit+")");<commit_msg>Added filter of QC results in Calibration Tests view<commit_after><html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:tal="http://xml.zope.org/namespaces/tal"
    xmlns:metal="http://xml.zope.org/namespaces/metal"
    xmlns:i18n="http://xml.zope.org/namespaces/i18n"
    metal:use-macro="here/main_template/macros/master"
    i18n:domain="bika">

<metal:slot fill-slot="head_slot">
    <style>
        #chart { text-align:center; white-space:nowrap; overflow:auto;height:300px;}
        .domain {
          fill: none;
          stroke: #3d3d3d;
          stroke-width: 1.5;
        }
        div.bika-listing-table-container {
            display:none;
        }

    </style>
    <script>
        jQuery(function($){
            $(document).ready(function(){

                // Populate analyses selector
                var data = $.parseJSON($('#graphdata').val());
                var qcrec = false;
                $.map(data, function(value,key){
                    $('#selanalyses').append('<option value="'+key+'">'+key+'</option>');
                    if (qcrec == false) {
                        $.map(value, function(v, k) {
                            $('#selqcsample').append('<option value="'+k+'">'+k+'</option>');
                        });
                        qcrec = true;
                    }
                });

                // Draw the chart and filter rows
                filterRows();
                drawControlChart();

                $('#selanalyses').change(function(e) {
                    drawControlChart();
                    filterRows();
                });

                $('#selqcsample').change(function(e) {
                    drawControlChart();
                    filterRows();
                });

                $('#interpolation').change(function(e) {
                    drawControlChart();
                });

                $('div.bika-listing-table-container').fadeIn();
            });
        });

        function filterRows() {
            var ankeyword = $('#selanalyses').val().split("(");
            ankeyword = ankeyword[ankeyword.length-1].slice(0,-1).trim();
            var idqc = $('#selqcsample').val();
            var count = 0;
            $('div.results-info').remove();
            $('.item-listing-tbody tr').each(function( index ) {
                if ($(this).attr('keyword') != ankeyword
                    || $(this).find('td.Partition a').html() != idqc) {
                    $(this).hide();
                } else {
                    $(this).fadeIn();
                    count+=1;
                }
            });
            $('.bika-listing-table').closest('div').before('<div class="results-info">'+count+' results found</div>');
        }

        function drawControlChart() {
            var analysiskey = $('#selanalyses').val();
            var reftype = $('#selqcsample').val();
            var interpolation = $('#interpolation').val()
            if ($("#chart svg").length > 0) {
                $("#chart").css('height', $("#chart").innerHeight());
                $("#chart").css('width', $("#chart").innerWidth());
            }
            $("#chart").html("");
            $("#chart").show();
            var data = $.parseJSON($('#graphdata').val());
            data = data[analysiskey]
            if (!(reftype in data) || data[reftype].length == 0) {
                // There is no results for this type of refsample
                $("#chart").hide();
                return;
            }
            data = data[reftype];
            var unit = data[data.length-1]['unit'];
            var upper = data[data.length-1]['upper'];
            var lower = data[data.length-1]['lower'];
            var target = data[data.length-1]['target'];
            var ylabel = "Result";
            if (unit == '' || typeof unit == 'undefined') {
                unit = "";
            } else {
                ylabel = unit;
            }

            var uppertxt = $.trim("UCL (" + upper+""+unit+")");
            var lowertxt = $.trim("LCL (" + lower+""+unit+")");
{'fraction_non_alphanumeric': 0.18613589567604666, 'fraction_numerical': 0.0075497597803706245, 'mean_word_length': 1.5511204481792717, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5998102', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1921, 'n_words': 320}