<commit_before>'use strict';

angular.module('funds').controller('FundController', ['$scope', '$rootScope', '$filter', 'Funds', 'Companies', 'Articles',
    function($scope, $rootScope, $filter, Funds, Companies, Articles) {
		// Controller Logic 
		// ...
    // Find a list of Funds

    var dope = function(){
      var fund = $scope.fund_is;

      $scope.updated = fund.updated;

      $scope.investedCapital = fund.investedCapital;
      $scope.mark = fund.mark;
      $scope.IRR = fund.IRR;
      $scope.multiple = fund.multiple;

      $scope.d_mark = fund.d_mark;
      $scope.d_IRR = fund.d_IRR;
      $scope.d_multiple = fund.d_multiple;

      $scope.b_mark = fund.b_mark;
      $scope.b_IRR = fund.b_IRR;
      $scope.b_multiple = fund.b_multiple;

      $scope.u_mark = fund.u_mark;
      $scope.u_IRR = fund.u_IRR;
      $scope.u_multiple = fund.u_multiple;

      $scope.activeState = fund.name;

      $scope.p = 'baseline'; //default on baseline

      Companies.query(function(companies) {
        console.log($scope.companies, 'companies', fund.name);
        $scope.companies = companies;
        $scope.filtered = $filter('filter')($scope.companies, {from_fund: fund.name}, true);
        $scope.filtered_news = $filter('filter')($scope.companies, {from_fund: fund.name, is_featured: true}, true);


        $scope.$watch('filtered', function(){
          setTimeout(function(){
            $('.company-photo').imagefill({throttle:1000/60});
            $('.company-photo').fadeIn();
          }, 2000)
        });
      });

      Articles.query(function(articles){
        console.log(fund.name, articles, 'articles');

        $scope.articles = articles;

        var filter_articles = function(article){
          var filter = _.pluck($scope.filtered, '_id');
          for(var i = 0; i < filter.length; i++) {
            if (filter[i] === article.for_company._id) {
              return true;
            };
          }
        };

        $scope.filter_article = $filter('filter')($scope.articles, filter_articles);
        $scope.filter_keyupdates = $filter('filter')($scope.filter_article, {is_keyupdate: true});
        console.log($scope.filter_keyupdates,'asdf');

        $scope.$watch('filter_article', function(){
            setTimeout(function(){
              $('.article-photo').imagefill({throttle:1000/60});
              $('.article-photo').fadeIn();
            }, 2000)
        });


      });
    };

    $scope.forCompany = function(asdf){
      console.log(asdf,'forcompany');
      return;
    }

    Funds.query(function(funds) {
      console.log(funds);
      $scope.data_or_news = 'data';
      $scope.funds = funds;

      if (typeof $rootScope.fund_is == "undefined") {
        $scope.fund_is = funds[0];
      } else {
        if ($rootScope.fund_is == 'Fund I'){
          $scope.fund_is = funds[0];
        } 
        else if ($rootScope.fund_is == 'Fund IA'){<commit_msg>articles load in funds view<commit_after>'use strict';

angular.module('funds').controller('FundController', ['$scope', '$rootScope', '$filter', 'Funds', 'Companies', 'Articles',
    function($scope, $rootScope, $filter, Funds, Companies, Articles) {
		// Controller Logic 
		// ...
    // Find a list of Funds

    var dope = function(){
      var fund = $scope.fund_is;

      $scope.updated = fund.updated;

      $scope.investedCapital = fund.investedCapital;
      $scope.mark = fund.mark;
      $scope.IRR = fund.IRR;
      $scope.multiple = fund.multiple;

      $scope.d_mark = fund.d_mark;
      $scope.d_IRR = fund.d_IRR;
      $scope.d_multiple = fund.d_multiple;

      $scope.b_mark = fund.b_mark;
      $scope.b_IRR = fund.b_IRR;
      $scope.b_multiple = fund.b_multiple;

      $scope.u_mark = fund.u_mark;
      $scope.u_IRR = fund.u_IRR;
      $scope.u_multiple = fund.u_multiple;

      $scope.activeState = fund.name;

      $scope.p = 'baseline'; //default on baseline

      Companies.query(function(companies) {
        console.log($scope.companies, 'companies', fund.name);
        $scope.companies = companies;
        $scope.filtered = $filter('filter')($scope.companies, {from_fund: fund.name}, true);
        $scope.filtered_news = $filter('filter')($scope.companies, {from_fund: fund.name, is_featured: true}, true);


        $scope.$watch('filtered', function(){
          setTimeout(function(){
            $('.company-photo').imagefill({throttle:1000/60});
            $('.company-photo').fadeIn();
          }, 2000)
        });

        Articles.query(function(articles){
          console.log(fund.name, articles, 'articles');
          $scope.articles = articles;

          var filter_articles = function(article){
            var filter = _.pluck($scope.filtered, '_id');
            for(var i = 0; i < filter.length; i++) {
              if (filter[i] === article.for_company._id) {
                return true;
              };
            }
          };

          $scope.filter_article = $filter('filter')($scope.articles, filter_articles);
          $scope.filter_keyupdates = $filter('filter')($scope.filter_article, {is_keyupdate: true});
          console.log($scope.filter_keyupdates,'asdf');

          $scope.$watch('filter_article', function(){
              setTimeout(function(){
                $('.article-photo').imagefill({throttle:1000/60});
                $('.article-photo').fadeIn();
              }, 2000)
          });
        });

      });

    };

    $scope.forCompany = function(asdf){
      console.log(asdf,'forcompany');
      return;
    }

    Funds.query(function(funds) {
      console.log(funds);
      $scope.data_or_news = 'data';
      $scope.funds = funds;

      if (typeof $rootScope.fund_is == "undefined") {
        $scope.fund_is = funds[0];
      } else {
        if ($rootScope.fund_is == 'Fund I'){
          $scope.fund_is = funds[0];
        } 
        else if ($rootScope.fund_is == 'Fund IA'){
{'fraction_non_alphanumeric': 0.16325840797701538, 'fraction_numerical': 0.007774209903667399, 'mean_word_length': 2.3472850678733033, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1445775', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1836, 'n_words': 309}