<commit_before>;(function() {
'use strict';                  

angular.module('gebo-client-performatives.conversationControl',
        ['gebo-client-performatives.request',
         'templates/server-reply-request.html',
         'templates/client-reply-request.html',
         'templates/server-propose-discharge-perform.html',
         'templates/client-propose-discharge-perform.html',
         'templates/server-reply-propose-discharge-perform.html',
         'templates/client-reply-propose-discharge-perform.html',
         'templates/server-perform.html']).
    directive('conversationControl', function ($templateCache, Request, $compile) {

    var _link = function(scope, element, attributes) {
        if (scope.sc && scope.email && scope.conversationId) {
            var directive = Request.getDirectiveName(JSON.parse(scope.sc), scope.email);
            element.html($templateCache.get('templates/' + directive + '.html'));
            $compile(element.contents())(scope);
        }
      };

    /**
     * Controller
     */
    var _controller = function($scope, $element, $attrs, $transclude) {

            $attrs.$observe('sc', function(newValue) {
                $scope.sc = newValue;
              });
    
            $attrs.$observe('email', function(newValue) {
                $scope.email = newValue;
              });
    
            $attrs.$observe('conversationId', function(newValue) {
                $scope.conversationId = newValue;
              });

            /**
             * agree
             */
            $scope.agree = function() {
                    Request.agree(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * notUnderstood
             */
            $scope.notUnderstood = function() {
                    Request.notUnderstood(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * refuse
             */
            $scope.refuse = function() {
                    Request.refuse(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * timeout
             */
            $scope.timeout = function() {
                    Request.timeout(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * failure
             */
            $scope.failure = function() {
                    Request.failure(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * proposeDischarge
             */
            $scope.proposeDischarge = function() {
                    Request.proposeDischarge(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * cancel
             */
            $scope.cancel = function() {
                    Request.cancel(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };
      };

    return {
            restrict: 'E',
            scope: true,
            link: _link,
            controller: _controller,
         };
      });
  }());

<commit_msg>Put watchers in link and _compileWhenReady<commit_after>;(function() {
'use strict';                  

angular.module('gebo-client-performatives.conversationControl',
        ['gebo-client-performatives.request',
         'templates/server-reply-request.html',
         'templates/client-reply-request.html',
         'templates/server-propose-discharge-perform.html',
         'templates/client-propose-discharge-perform.html',
         'templates/server-reply-propose-discharge-perform.html',
         'templates/client-reply-propose-discharge-perform.html',
         'templates/server-perform.html']).
    directive('conversationControl', function ($templateCache, Request, $compile) {

    var _link = function(scope, element, attributes) {
        attributes.$observe('sc', function(newValue) {
            scope.sc = newValue;
            _compileWhenReady(scope, element);
          });
    
        attributes.$observe('email', function(newValue) {
            scope.email = newValue;
            _compileWhenReady(scope, element);
          });
    
        attributes.$observe('conversationId', function(newValue) {
            scope.conversationId = newValue;
            _compileWhenReady(scope, element);
          });

//        if (scope.sc && scope.email && scope.conversationId) {
//            var directive = Request.getDirectiveName(JSON.parse(scope.sc), scope.email);
//            element.html($templateCache.get('templates/' + directive + '.html'));
//            $compile(element.contents())(scope);
//        }
      };

    var _compileWhenReady = function(scope, element) {
        if (scope.sc && scope.email && scope.conversationId) {
            var directive = Request.getDirectiveName(JSON.parse(scope.sc), scope.email);
            element.html($templateCache.get('templates/' + directive + '.html'));
            $compile(element.contents())(scope);
        }
      };

    /**
     * Controller
     */
    var _controller = function($scope, $element, $attrs, $transclude) {

            /**
             * agree
             */
            $scope.agree = function() {
                    Request.agree(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * notUnderstood
             */
            $scope.notUnderstood = function() {
                    Request.notUnderstood(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * refuse
             */
            $scope.refuse = function() {
                    Request.refuse(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * timeout
             */
            $scope.timeout = function() {
                    Request.timeout(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * failure
             */
            $scope.failure = function() {
                    Request.failure(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * proposeDischarge
             */
            $scope.proposeDischarge = function() {
                    Request.proposeDischarge(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };

            /**
             * cancel
             */
            $scope.cancel = function() {
                    Request.cancel(JSON.parse($scope.sc), $scope.email, $scope.conversationId);
                };
      };

    return {
            restrict: 'E',
            scope: true,
            link: _link,
            controller: _controller,
         };
      });
  }());


{'fraction_non_alphanumeric': 0.13808076422058185, 'fraction_numerical': 0.0, 'mean_word_length': 1.5507567368032484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4212950', 'n_tokens_mistral': 1823, 'n_tokens_neox': 1762, 'n_words': 235}