<commit_before>var http = require( 'http' );
var async = require( 'async' );
var person = require( './Person' );
var GetData = require( './Request' );
var buildStatus = require( './Builds' );
var file = require( './FileIO' );
var userInfo = require( './getUsers' );
var _ = require( 'lodash' );
var checkdouble = require( './checkUsername' );
var redis = require( 'redis-url' ).connect( process.env.REDISTOGO_URL );
var excludedBuilds = require( 'config' ).ExcludeBuilds;
var Failed = require('./lastBuild');
var builds = "";
var buildID = "";
var buildstatus = [];
var change = [];
var usersarray = {};
var failedArray = {};
var fileio = new file();
function getPoints( buildId, Person ) {
    async.series( [
        function ( callback ) {
            GetData( "/httpAuth/app/rest/builds/id:" + buildId, function ( result ) {
                builds = result;
                callback( null, builds );
            });
        },
        function ( callback ) {
            change = [];
            GetData( builds['changes']['href'], function ( result ) {
                for ( var i = 0; i < result['change'].length; i++ ) {
                    if ( result['change'] != null ) {
                        change.push( result['change'][i]['href'] );
                    } else {
                        change.push( null );
                    }
                }
                callback( null, null );


            });
        },
        function ( callback ) {
            async.mapSeries( change, getName, function ( error, names ) {
                callback( null, names );
            });
        },
        function(callback) {
            Failed(function(result) {
                callback(null,result);
            });

        }
    ],
        function ( err, results ) {
            /*try {*/

            redis.get( "obj", function ( er, data ) {
                if ( data ) {
                    var tempfile = JSON.parse( data );
                    for ( var user in tempfile ) {
                        usersarray[user] = new person( tempfile[user]['name'] );
                        usersarray[user].lastdate = tempfile[user]['lastdate'];
                        usersarray[user].build = tempfile[user]['build'];
                        usersarray[user].gravUrl = tempfile[user]['gravUrl'];
                        usersarray[user].status = tempfile[user]['status'];
                        usersarray[user].streak = tempfile[user]['streak'];
                        usersarray[user].points = tempfile[user]['points'];

                    }
                }

                
                var userName;
                
                buildstatus[0] = new buildStatus( results[0]['buildType']['name'], results[0]['status'], results[0]['buildType']['id'], results[0]['startDate'], results[0]['finishDate'] );
                var uniqpersons = _.uniq( results[2] );

                for ( var k = 0; k < uniqpersons.length; k++ ) {
                    if ( uniqpersons[k] != "undefined" && uniqpersons[k] != null ) {
                        userName = checkdouble( uniqpersons[k] );
                        if ( !usersarray[uniqpersons[k]] ) {

                            usersarray[userName] = new person( userName );
                        }
                    } else {
                        userName = null;
                    }


                    if ( usersarray[userName] ) {
                        if ( results[0] != null && !_.contains( excludedBuilds, buildstatus[0]['id'] ) ) {
                            if ( buildstatus[0]['status'] == "SUCCESS" ) {
                                usersarray[userName].addPoints( 1 );
                                usersarray[userName].lastdate = ( buildstatus[0]['finishdate'] );
                                usersarray[userName].build.push( buildstatus[0]['id'] );
                                if (usersarray[userName].streak5 == true) {
                                    usersarray[userName].streak5 = false;
                                }
                                if ( usersarray[userName].status && usersarray[userName].status == "Success" ) {
                                    if ( usersarray[userName].streak < 5 ) {
                                        usersarray[userName].streakAdd();
                                    }
                                    if ( usersarray[userName].streak >= 5 ) {
                                        usersarray[userName].streak5=true;
                                        usersarray[userName].streakReset();
                                        usersarray[userName].addPoints( 4 );
                                    }
                                }
                                usersarray[userName].status = "Success";
                            } else if ( buildstatus[0]['status'] == "FAILURE" && !_.contains( excludedBuilds, buildstatus[0]['id'] ) ) {<commit_msg>streak 5 reset disabled when still successful build<commit_after>var http = require( 'http' );
var async = require( 'async' );
var person = require( './Person' );
var GetData = require( './Request' );
var buildStatus = require( './Builds' );
var file = require( './FileIO' );
var userInfo = require( './getUsers' );
var _ = require( 'lodash' );
var checkdouble = require( './checkUsername' );
var redis = require( 'redis-url' ).connect( process.env.REDISTOGO_URL );
var excludedBuilds = require( 'config' ).ExcludeBuilds;
var Failed = require('./lastBuild');
var builds = "";
var buildID = "";
var buildstatus = [];
var change = [];
var usersarray = {};
var failedArray = {};
var fileio = new file();
function getPoints( buildId, Person ) {
    async.series( [
        function ( callback ) {
            GetData( "/httpAuth/app/rest/builds/id:" + buildId, function ( result ) {
                builds = result;
                callback( null, builds );
            });
        },
        function ( callback ) {
            change = [];
            GetData( builds['changes']['href'], function ( result ) {
                for ( var i = 0; i < result['change'].length; i++ ) {
                    if ( result['change'] != null ) {
                        change.push( result['change'][i]['href'] );
                    } else {
                        change.push( null );
                    }
                }
                callback( null, null );


            });
        },
        function ( callback ) {
            async.mapSeries( change, getName, function ( error, names ) {
                callback( null, names );
            });
        },
        function(callback) {
            Failed(function(result) {
                callback(null,result);
            });

        }
    ],
        function ( err, results ) {
            /*try {*/

            redis.get( "obj", function ( er, data ) {
                if ( data ) {
                    var tempfile = JSON.parse( data );
                    for ( var user in tempfile ) {
                        usersarray[user] = new person( tempfile[user]['name'] );
                        usersarray[user].lastdate = tempfile[user]['lastdate'];
                        usersarray[user].build = tempfile[user]['build'];
                        usersarray[user].gravUrl = tempfile[user]['gravUrl'];
                        usersarray[user].status = tempfile[user]['status'];
                        usersarray[user].streak = tempfile[user]['streak'];
                        usersarray[user].points = tempfile[user]['points'];

                    }
                }

                
                var userName;
                
                buildstatus[0] = new buildStatus( results[0]['buildType']['name'], results[0]['status'], results[0]['buildType']['id'], results[0]['startDate'], results[0]['finishDate'] );
                var uniqpersons = _.uniq( results[2] );

                for ( var k = 0; k < uniqpersons.length; k++ ) {
                    if ( uniqpersons[k] != "undefined" && uniqpersons[k] != null ) {
                        userName = checkdouble( uniqpersons[k] );
                        if ( !usersarray[uniqpersons[k]] ) {

                            usersarray[userName] = new person( userName );
                        }
                    } else {
                        userName = null;
                    }


                    if ( usersarray[userName] ) {
                        if ( results[0] != null && !_.contains( excludedBuilds, buildstatus[0]['id'] ) ) {
                            if ( buildstatus[0]['status'] == "SUCCESS" ) {
                                usersarray[userName].addPoints( 1 );
                                usersarray[userName].lastdate = ( buildstatus[0]['finishdate'] );
                                usersarray[userName].build.push( buildstatus[0]['id'] );
                                if ( usersarray[userName].status && usersarray[userName].status == "Success" ) {
                                    if ( usersarray[userName].streak < 5 ) {
                                        usersarray[userName].streakAdd();
                                    }
                                    if ( usersarray[userName].streak >= 5 ) {
                                        usersarray[userName].streak5=true;
                                        usersarray[userName].streakReset();
                                        usersarray[userName].addPoints( 4 );
                                    }
                                }
                                usersarray[userName].status = "Success";
                            } else if ( buildstatus[0]['status'] == "FAILURE" && !_.contains( excludedBuilds, buildstatus[0]['id'] ) ) {
{'fraction_non_alphanumeric': 0.13430686960098726, 'fraction_numerical': 0.00462772521596051, 'mean_word_length': 1.2985109903096195, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1815573', 'n_tokens_mistral': 2430, 'n_tokens_neox': 2299, 'n_words': 484}