<commit_before>// vi:si:et:sw=2:sts=2:ts=2

// FIXME: remove use of hoodie here; this should be data-store-agnostic

/**
 * @ngdoc     controller
 * @name      mushin.controller:ThingsController
 * @requires  $scope
 *
 * @description <p>The things controller controls the view of
 *              things.</p>
 *
 *              <p>A parent scope should provide the following members:
 *                 <dl>
 *                   <dt>projects</dt>
 *                   <dd>dict of projects</dd>
 *                   <dt>contexts</dt>
 *                   <dd>dict of contexts</dd>
 *                   <dt>importance</dt>
 *                   <dd>dict of importance</dd>
 *                   <dt>urgency</dt>
 *                   <dd>dict of urgency</dd>
 *                 </dl>
 *              </p>
 *
 * @author    <NAME> <thomas (at) apestaart (dot) org>
 */
angular.module('mushin').controller(
  'ThingsController',
  function($scope, $rootScope, $state, $location, $q, $cookieStore,
    things, Thing,
    lists, hoodie) {

    /* lists is app/scripts/services/lists.js */

    var debug = new window.$debug('mushin:ThingsController');

    /* FIXME: can be used somewhere else to mock out hoodie
    if ($state.current.data.mock.indexOf("hoodie") > -1) {
      hoodie = {
        store: {
          findAll: function() { return Promise.resolve([{}, {}]) }
        }
      };
    }
    */

    /* private functions */
    function fetchThings() {

      var start = new Date();
      var deferred = $q.defer();

      debug('fetchThings: calling getAll');
      things.getAll(Thing.ACTIVE)
        .then(function(/* things */) {
          debug('fetchThings: called getAll in ' +
              (new Date().getTime() - start.getTime()) +
              ' ms');
          // at this time, the rootScope contexts/projects are set and thus
          // available through $scope too

          // parse query params from search entry now
          if (search.query) {
            var parser = new window.Parser();
            var parsed = parser.parse(search.query);
            debug('controllers/things.js: parsed query ' + JSON.stringify(parsed));


            /* FIXME: reset old filter state; roll into helper */
            angular.forEach($scope.contexts, function(value, key) {
              $scope.contexts[key].active = false;
            });
            angular.forEach($scope.projects, function(value, key) {
              $scope.projects[key].active = false;
            });
            angular.forEach($scope.importance, function(value, key) {<commit_msg>remove commented out hoodie mock<commit_after>// vi:si:et:sw=2:sts=2:ts=2

// FIXME: remove use of hoodie here; this should be data-store-agnostic

/**
 * @ngdoc     controller
 * @name      mushin.controller:ThingsController
 * @requires  $scope
 *
 * @description <p>The things controller controls the view of
 *              things.</p>
 *
 *              <p>A parent scope should provide the following members:
 *                 <dl>
 *                   <dt>projects</dt>
 *                   <dd>dict of projects</dd>
 *                   <dt>contexts</dt>
 *                   <dd>dict of contexts</dd>
 *                   <dt>importance</dt>
 *                   <dd>dict of importance</dd>
 *                   <dt>urgency</dt>
 *                   <dd>dict of urgency</dd>
 *                 </dl>
 *              </p>
 *
 * @author    <NAME> <thomas (at) apestaart (dot) org>
 */
angular.module('mushin').controller(
  'ThingsController',
  function($scope, $rootScope, $state, $location, $q, $cookieStore,
    things, Thing,
    lists, hoodie) {

    /* lists is app/scripts/services/lists.js */

    var debug = new window.$debug('mushin:ThingsController');

    /* private functions */
    function fetchThings() {

      var start = new Date();
      var deferred = $q.defer();

      debug('fetchThings: calling getAll');
      things.getAll(Thing.ACTIVE)
        .then(function(/* things */) {
          debug('fetchThings: called getAll in ' +
              (new Date().getTime() - start.getTime()) +
              ' ms');
          // at this time, the rootScope contexts/projects are set and thus
          // available through $scope too

          // parse query params from search entry now
          if (search.query) {
            var parser = new window.Parser();
            var parsed = parser.parse(search.query);
            debug('controllers/things.js: parsed query ' + JSON.stringify(parsed));


            /* FIXME: reset old filter state; roll into helper */
            angular.forEach($scope.contexts, function(value, key) {
              $scope.contexts[key].active = false;
            });
            angular.forEach($scope.projects, function(value, key) {
              $scope.projects[key].active = false;
            });
            angular.forEach($scope.importance, function(value, key) {
{'fraction_non_alphanumeric': 0.13452914798206278, 'fraction_numerical': 0.0014268242967794538, 'mean_word_length': 1.8298731257208767, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 52, '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': '343285', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1343, 'n_words': 343}