<commit_before>/**
 * Created by starov on 05.09.14.
 */
fruitStory.directive("feed", function() {
    return {
        restrict: "A",
        templateUrl: 'partials/feed.html',
        scope: {
            mtd:'=',
            feed:'=feedSource',
            rating:'=feedRating',
            ratingMode:'=feedRatingMode',
            persona:'='
        },
        controller: function ($scope) {

            $scope.mtd.addToFeed = function (saying) {
                var said;
                var found=false;
                if (saying && saying.title && saying.type && saying.letters) {

                    said = angular.copy(saying);
                    saying.text='';
                    saying.title='';
                    saying.letters='';
                    saying.image='';
                    said.letters=convertLetters(said.letters);
                    said.author=$scope.mtd.persona;
                    said.time=Date.now();
                    angular.forEach($scope.feed, function (val, key) {
                        if (val.letters && val.letters==said.letters) {
                            found = key;
                        }
                    });
                    if ($scope.mtd.firebase) {
                        if (found) {
                            console.log(said);
                            $scope.feed[found]=said;
                            $scope.feed.$save(found);
                            console.log($scope.feed[found]);
                        } else $scope.feed.$add(said);

                    } else {
                        if (found) {
                            $scope.feed[found]=said;
                        } else {
                            $scope.feed.push(said);
                        }
                    }

                } else {console.log('a phrase without title, type, or color/letters')}

                $scope.updateTree();
            };

            $scope.updateTree=function () {
                $scope.tree=convertStory($scope.feed);
                $scope.source=$scope.tree;
            };

            $scope.mtd.updateTree=$scope.updateTree;

            $scope.$watch('feed', function () {
                $scope.updateTree();
            });

<commit_msg>smooth edition of phrases<commit_after>/**
 * Created by starov on 05.09.14.
 */
fruitStory.directive("feed", function() {
    return {
        restrict: "A",
        templateUrl: 'partials/feed.html',
        scope: {
            mtd:'=',
            feed:'=feedSource',
            rating:'=feedRating',
            ratingMode:'=feedRatingMode',
            persona:'='
        },
        controller: function ($scope) {

            $scope.mtd.addToFeed = function (saying) {
                var said;
                var found=false;
                if (saying && saying.title && saying.type && saying.letters) {

                    said = angular.copy(saying);
                    saying.text='';
                    saying.title='';
                    saying.letters='';
                    saying.image='';
                    said.letters=convertLetters(said.letters);
                    said.author=$scope.mtd.persona;
                    said.time=Date.now();
                    angular.forEach($scope.feed, function (val, key) {
                        if (val.letters && val.letters==said.letters) {
                            found = key;
                        }
                    });
                    if ($scope.mtd.firebase) {
                        if (found) {
                            $scope.feed[found]=said;
                            $scope.feed.$save(found);
                        } else $scope.feed.$add(said);

                    } else {
                        if (found) {
                            $scope.feed[found]=said;
                        } else {
                            $scope.feed.push(said);
                        }
                    }

                } else {console.log('a phrase without title, type, or color/letters')}

                $scope.updateTree();
            };

            $scope.updateTree=function () {
                $scope.tree=convertStory($scope.feed);
                $scope.source=$scope.tree;
            };

            $scope.mtd.updateTree=$scope.updateTree;

            $scope.$watch('feed', function () {
                $scope.updateTree();
            });


{'fraction_non_alphanumeric': 0.1248868778280543, 'fraction_numerical': 0.0027149321266968325, 'mean_word_length': 1.0086324398000908, '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': '1510455', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1048, 'n_words': 169}