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

  angular
    .module('dailyDocumentary')
    .controller('DocDetailsController', DocDetailsController);

  DocDetailsController.$inject = ['$mdToast', '$stateParams', '$scope', 'docFactory', 'profileFactory'];

  function DocDetailsController($mdToast, $stateParams, $scope, docFactory, profileFactory) {
    var vm = this;
    vm.addToTimeline = addToTimeline;
    vm.addToWatchlist = addToWatchlist;
    vm.docDetails = [];
    vm.docActions = $stateParams.docActions;

    activate();

    function activate() {
      $scope.$emit('loading', true);
      docFactory.getDocDetails($stateParams.movie).then(function(data) {
        vm.docDetails = data;
        $scope.$emit('loading', false);
      });
    }

    function addToTimeline() {
      return profileFactory.addToTimeline(vm.docActions)
                           .then(showMessage);

        function showMessage(response) {
          $mdToast.showSimple(response.pop().title + ' added to timeline');
        }
    }

    function addToWatchlist() {
      return profileFactory.addToWatchlist(vm.docActions)
                           .then(showMessage);

        function showMessage(response) {
          $mdToast.showSimple(response.pop().title + ' added to watchlist');<commit_msg>injected  service to filterresponse after adding to timeline or watchlist<commit_after>(function() {
  'use strict';

  angular
    .module('dailyDocumentary')
    .controller('DocDetailsController', DocDetailsController);

  DocDetailsController.$inject = ['$filter', '$mdToast', '$stateParams', '$scope', 'docFactory', 'profileFactory'];

  function DocDetailsController($filter, $mdToast, $stateParams, $scope, docFactory, profileFactory) {
    var vm = this;
    vm.addToTimeline = addToTimeline;
    vm.addToWatchlist = addToWatchlist;
    vm.docDetails = [];
    vm.docActions = $stateParams.docActions;

    activate();

    function activate() {
      $scope.$emit('loading', true);
      docFactory.getDocDetails($stateParams.movie).then(function(data) {
        vm.docDetails = data;
        $scope.$emit('loading', false);
      });
    }

    function addToTimeline() {
      return profileFactory.addToTimeline(vm.docActions)
                           .then(showMessage);

        function showMessage(response) {
          var addedDoc = $filter('filter')(response, {title: vm.docActions.title}, true);
          $mdToast.showSimple(addedDoc.pop().title + ' added to timeline');
        }
    }

    function addToWatchlist() {
      return profileFactory.addToWatchlist(vm.docActions)
                           .then(showMessage);

        function showMessage(response) {
          var addedDoc = $filter('filter')(response, {title: vm.docActions.title}, true);
          $mdToast.showSimple(addedDoc.pop().title + ' added to watchlist');
{'fraction_non_alphanumeric': 0.13113604488078542, 'fraction_numerical': 0.0, 'mean_word_length': 3.0932568149210904, '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': '3832344', 'n_tokens_mistral': 811, 'n_tokens_neox': 785, 'n_words': 144}