<commit_before>(function () {
    var cohortVisualization = angular.module('redash.visualization');

    cohortVisualization.config(['VisualizationProvider', function(VisualizationProvider) {

      var editTemplate = '<cohort-editor></cohort-editor>';
        var defaultOptions = {
          'timeInterval': 'daily',
          'timeLabel': 'day'
        };

        VisualizationProvider.registerVisualization({
            type: 'COHORT',
            name: 'Cohort',
            renderTemplate: '<cohort-renderer options="visualization.options" query-result="queryResult"></cohort-renderer>',
            editorTemplate: editTemplate,
            defaultOptions: defaultOptions
        });
    }]);

    cohortVisualization.directive('cohortRenderer', function() {
        return {
            restrict: 'E',
            scope: {
                queryResult: '='
            },
            template: "",
            replace: false,
            link: function($scope, element, attrs) {
                $scope.$watch('[queryResult && queryResult.getData(), visualization.options]', function () {
                    if ($scope.queryResult.getData() == null) {

                    } else {
                        var sortedData = _.sortBy($scope.queryResult.getData(),function(r) {
                          return r['date'] + r['day_number']  ;
                        });
                        
                        var grouped = _.groupBy(sortedData, "date");<commit_msg>explicitly pass in just timeInterval and timeLabel from visualization.options to be watched<commit_after>(function () {
    var cohortVisualization = angular.module('redash.visualization');

    cohortVisualization.config(['VisualizationProvider', function(VisualizationProvider) {

      var editTemplate = '<cohort-editor></cohort-editor>';
        var defaultOptions = {
          'timeInterval': 'daily',
          'timeLabel': 'day'
        };

        VisualizationProvider.registerVisualization({
            type: 'COHORT',
            name: 'Cohort',
            renderTemplate: '<cohort-renderer options="visualization.options" query-result="queryResult"></cohort-renderer>',
            editorTemplate: editTemplate,
            defaultOptions: defaultOptions
        });
    }]);

    cohortVisualization.directive('cohortRenderer', function() {
        return {
            restrict: 'E',
            scope: {
                queryResult: '='
            },
            template: "",
            replace: false,
            link: function($scope, element, attrs) {
                $scope.$watch('[queryResult && queryResult.getData(), visualization.options.timeInterval, visualization.options.timeLabel]', function () {
                    if ($scope.queryResult.getData() == null) {

                    } else {
                        var sortedData = _.sortBy($scope.queryResult.getData(),function(r) {
                          return r['date'] + r['day_number']  ;
                        });
                        
                        var grouped = _.groupBy(sortedData, "date");
{'fraction_non_alphanumeric': 0.12346079066753078, 'fraction_numerical': 0.0, 'mean_word_length': 1.8877455565949486, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3942757', 'n_tokens_mistral': 770, 'n_tokens_neox': 729, 'n_words': 131}