<commit_before>function doMatrix(context, matrixData)
{
    var data = matrixData['data'];
    var memberId = matrixData['memberId'];
    var width = 800;
    var height = 400;
    var bottomMargin = 26;
    var horizontalMargin = 120;
    var matrixData = new Array();
    var minx = horizontalMargin;
    var minProductivity = 10000;
    var maxx = width - horizontalMargin;
    var maxProductivity = -10000;
    var maxConsciousness = -100000;

    var avgProductivity = 0;
    var avgConsciousness = 0;
    var current_value = 0;
    var sumConsciousness = 0;
    var sumProductivity = 0;

    for (var i in data) {
        if (data[i]['productivity'] < minProductivity)
            minProductivity = data[i]['productivity'];
        if (data[i]['productivity'] > maxProductivity)
            maxProductivity = data[i]['productivity'];
        if (Math.abs(data[i]['consciousness']) > maxConsciousness)
            maxConsciousness = Math.abs(data[i]['consciousness']);

        sumConsciousness = sumConsciousness + data[i]['consciousness'];
        sumProductivity = sumProductivity + data[i]['productivity'];
    }

    var deltax = maxx - minx;
    var deltaProductivity = maxProductivity - minProductivity;

    avgProductivity = sumProductivity / data.length;
    avgConsciousness = sumConsciousness / data.length;
    sumConsciousness = 0;

    for (var i in data) {
        current_value = data[i]['consciousness'];
        sumConsciousness = sumConsciousness + Math.pow((current_value - avgConsciousness), 2);
    }
    var stardarDeviation = Math.sqrt(sumConsciousness / (data.length - 1)); //standar deviation

    var maxy = (Math.floor((maxConsciousness + 1) / 10) + 1) * 10;

    for (var i in data) {
        var posx = Math.floor((data[i]['productivity'] - minProductivity) / deltaProductivity * deltax + minx);
        var posy = Math.floor((maxy - data[i]['consciousness']) * (height - bottomMargin) / 2 / maxy);
        var valueToPush = new Array();
        valueToPush.push(data[i]['name']);
        valueToPush.push(posx);
        valueToPush.push(posy);
        valueToPush.push(data[i]['id']);
        matrixData.push(valueToPush);
    }

    var goodConsciousnessY1 = Math.floor((maxy - stardarDeviation) * (height - bottomMargin) / 2 / maxy);
    var goodConsciousnessY2 = Math.floor((maxy + stardarDeviation) * (height - bottomMargin) / 2 / maxy);
    var goodConsciousnessYAxe = Math.floor((height - bottomMargin) / 2);

    //high conciouness zone
    context.beginPath();
    context.rect(0, goodConsciousnessY1, width, goodConsciousnessY2 - goodConsciousnessY1);
    context.fillStyle = '#d9edf7';
    context.fill();
    context.strokeStyle = '#5a9bbc';
    context.stroke();

    // do cool things with the context
    context.font = '12pt Helvetica';
    context.fillStyle = 'red';
    context.textAlign = 'left';
    context.textBaseline = 'top';
    context.fillText('BC/BP+', 5, 5);
    context.textBaseline = 'bottom';
    context.fillText('AC/BP', 5, goodConsciousnessYAxe - 2);
    context.textAlign = 'left';
    context.textBaseline = 'bottom';
    context.fillText('BC/BP-', 5, height - 5);
    context.textAlign = 'right';
    context.textBaseline = 'top';
    context.fillText('BC/AP+', width - 5, 5);
    context.textBaseline = 'bottom';
    context.fillText('AC/AP', width - 5, goodConsciousnessYAxe - 2);
    context.textAlign = 'right';
    context.textBaseline = 'bottom';
    context.fillText('BC/AP-', width - 5, height - 5);

    //axes
    posx = (avgProductivity - minProductivity) / deltaProductivity * deltax + minx;
    context.strokeStyle = '#5a9bbc';
    context.beginPath();
    context.moveTo(0, goodConsciousnessYAxe);
    context.lineTo(width, goodConsciousnessYAxe);
    context.moveTo(posx, 0);
    context.lineTo(posx, height - 26);
    context.moveTo(minx, 0);
    context.lineTo(minx, height - 26);
    context.moveTo(maxx, 0);
    context.lineTo(maxx, height - 26);
    context.stroke();

    //axes values
    context.font = '11pt Helvetica';
    context.fillStyle = '#496987';
    context.textAlign = 'center';
    context.textBaseline = 'bottom';
    context.fillText('Min: ' + Math.round(minProductivity * 10) / 10 + ' %', minx, height - 5);
    context.fillText('Max: ' + Math.round(maxProductivity * 10) / 10 + ' %', maxx, height - 5);
    context.fillText('Prom: ' + Math.round(avgProductivity * 10) / 10 + ' %', posx, height - 5);

    context.textAlign = 'center';
    context.textBaseline = 'top';
    context.lineWidth = 1;
    context.font = '11pt Helvetica';

    for (i in matrixData)
        if (matrixData[i][3] != memberId) {
            context.beginPath();

            context.arc(matrixData[i][1], matrixData[i][2], 12, 0, 2 * Math.PI, false);

            if (Math.abs(data[i]['consciousness']) < stardarDeviation)
                context.fillStyle = '#5bc0de';
            else
                context.fillStyle = '#f0ad4e';
            context.fill();
            context.strokeStyle = '#5a9bbc';
            context.stroke();
            context.fillStyle = '#496987';
            context.fillText(matrixData[i][0], matrixData[i][1], matrixData[i][2] + 16);
        }

    context.lineWidth = 5;
    context.font = 'bold 11pt Helvetica';
    for (i in matrixData)
        if (matrixData[i][3] == memberId)
        {
            context.beginPath();

            context.arc(matrixData[i][1], matrixData[i][2], 12, 0, 2 * Math.PI, false);

            if (Math.abs(data[i]['consciousness']) < stardarDeviation)
                context.fillStyle = '#5bc0de';
            else
                context.fillStyle = '#f0ad4e';
            context.fill();
            context.strokeStyle = '#5a9bbc';
            context.stroke();
            context.fillStyle = '#496987';
            context.fillText(matrixData[i][0], matrixData[i][1], matrixData[i][2] + 16);
        }
}
<commit_msg>Change high consciouness member color<commit_after>function doMatrix(context, matrixData)
{
    var data = matrixData['data'];
    var memberId = matrixData['memberId'];
    var width = 800;
    var height = 400;
    var bottomMargin = 26;
    var horizontalMargin = 120;
    var matrixData = new Array();
    var minx = horizontalMargin;
    var minProductivity = 10000;
    var maxx = width - horizontalMargin;
    var maxProductivity = -10000;
    var maxConsciousness = -100000;

    var avgProductivity = 0;
    var avgConsciousness = 0;
    var current_value = 0;
    var sumConsciousness = 0;
    var sumProductivity = 0;

    for (var i in data) {
        if (data[i]['productivity'] < minProductivity)
            minProductivity = data[i]['productivity'];
        if (data[i]['productivity'] > maxProductivity)
            maxProductivity = data[i]['productivity'];
        if (Math.abs(data[i]['consciousness']) > maxConsciousness)
            maxConsciousness = Math.abs(data[i]['consciousness']);

        sumConsciousness = sumConsciousness + data[i]['consciousness'];
        sumProductivity = sumProductivity + data[i]['productivity'];
    }

    var deltax = maxx - minx;
    var deltaProductivity = maxProductivity - minProductivity;

    avgProductivity = sumProductivity / data.length;
    avgConsciousness = sumConsciousness / data.length;
    sumConsciousness = 0;

    for (var i in data) {
        current_value = data[i]['consciousness'];
        sumConsciousness = sumConsciousness + Math.pow((current_value - avgConsciousness), 2);
    }
    var stardarDeviation = Math.sqrt(sumConsciousness / (data.length - 1)); //standar deviation

    var maxy = (Math.floor((maxConsciousness + 1) / 10) + 1) * 10;

    for (var i in data) {
        var posx = Math.floor((data[i]['productivity'] - minProductivity) / deltaProductivity * deltax + minx);
        var posy = Math.floor((maxy - data[i]['consciousness']) * (height - bottomMargin) / 2 / maxy);
        var valueToPush = new Array();
        valueToPush.push(data[i]['name']);
        valueToPush.push(posx);
        valueToPush.push(posy);
        valueToPush.push(data[i]['id']);
        matrixData.push(valueToPush);
    }

    var goodConsciousnessY1 = Math.floor((maxy - stardarDeviation) * (height - bottomMargin) / 2 / maxy);
    var goodConsciousnessY2 = Math.floor((maxy + stardarDeviation) * (height - bottomMargin) / 2 / maxy);
    var goodConsciousnessYAxe = Math.floor((height - bottomMargin) / 2);

    //high conciouness zone
    context.beginPath();
    context.rect(0, goodConsciousnessY1, width, goodConsciousnessY2 - goodConsciousnessY1);
    context.fillStyle = '#d9edf7';
    context.fill();
    context.strokeStyle = '#5a9bbc';
    context.stroke();

    // do cool things with the context
    context.font = '12pt Helvetica';
    context.fillStyle = 'red';
    context.textAlign = 'left';
    context.textBaseline = 'top';
    context.fillText('BC/BP+', 5, 5);
    context.textBaseline = 'bottom';
    context.fillText('AC/BP', 5, goodConsciousnessYAxe - 2);
    context.textAlign = 'left';
    context.textBaseline = 'bottom';
    context.fillText('BC/BP-', 5, height - 5);
    context.textAlign = 'right';
    context.textBaseline = 'top';
    context.fillText('BC/AP+', width - 5, 5);
    context.textBaseline = 'bottom';
    context.fillText('AC/AP', width - 5, goodConsciousnessYAxe - 2);
    context.textAlign = 'right';
    context.textBaseline = 'bottom';
    context.fillText('BC/AP-', width - 5, height - 5);

    //axes
    posx = (avgProductivity - minProductivity) / deltaProductivity * deltax + minx;
    context.strokeStyle = '#5a9bbc';
    context.beginPath();
    context.moveTo(0, goodConsciousnessYAxe);
    context.lineTo(width, goodConsciousnessYAxe);
    context.moveTo(posx, 0);
    context.lineTo(posx, height - 26);
    context.moveTo(minx, 0);
    context.lineTo(minx, height - 26);
    context.moveTo(maxx, 0);
    context.lineTo(maxx, height - 26);
    context.stroke();

    //axes values
    context.font = '11pt Helvetica';
    context.fillStyle = '#496987';
    context.textAlign = 'center';
    context.textBaseline = 'bottom';
    context.fillText('Min: ' + Math.round(minProductivity * 10) / 10 + ' %', minx, height - 5);
    context.fillText('Max: ' + Math.round(maxProductivity * 10) / 10 + ' %', maxx, height - 5);
    context.fillText('Prom: ' + Math.round(avgProductivity * 10) / 10 + ' %', posx, height - 5);

    context.textAlign = 'center';
    context.textBaseline = 'top';
    context.lineWidth = 1;
    context.font = '11pt Helvetica';

    for (i in matrixData)
        if (matrixData[i][3] != memberId) {
            context.beginPath();

            context.arc(matrixData[i][1], matrixData[i][2], 12, 0, 2 * Math.PI, false);

            if (Math.abs(data[i]['consciousness']) < stardarDeviation)
                context.fillStyle = '#5cb85c';
            else
                context.fillStyle = '#f0ad4e';
            context.fill();
            context.strokeStyle = '#5a9bbc';
            context.stroke();
            context.fillStyle = '#496987';
            context.fillText(matrixData[i][0], matrixData[i][1], matrixData[i][2] + 16);
        }

    context.lineWidth = 6;
    context.font = 'bold 11pt Helvetica';
    for (i in matrixData)
        if (matrixData[i][3] == memberId)
        {
            context.beginPath();

            context.arc(matrixData[i][1], matrixData[i][2], 12, 0, 2 * Math.PI, false);

            if (Math.abs(data[i]['consciousness']) < stardarDeviation)
                context.fillStyle = '#5cb85c';
            else
                context.fillStyle = '#f0ad4e';
            context.fill();
            context.strokeStyle = '#5a9bbc';
            context.stroke();
            context.fillStyle = '#496987';
            context.fillText(matrixData[i][0], matrixData[i][1], matrixData[i][2] + 16);
        }
}

{'fraction_non_alphanumeric': 0.14326939399083347, 'fraction_numerical': 0.026990324223391614, 'mean_word_length': 2.77056, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7173773', 'n_tokens_mistral': 4001, 'n_tokens_neox': 3715, 'n_words': 780}