<commit_before>(function() {
  'use strict';
  angular.module('civic.services')
    .factory('StatsResource', StatsResource)
    .factory('Stats', StatsService);

  // @ngInject
  function StatsResource($resource) {

    return $resource('',
      { },
      {
        site: {
          url: '/api/stats/site',
          method: 'GET',
          isArray: false,
          cache: false
        },
        user: {
          url: '/api/users/:userId/stats',
          params: {
            userId: '@userId'
          },
          method: 'GET',
          isArray: false,
          cache: false
        },
        organization: {
          url: '/api/organizations/:organizationId/stats',
          params: {
            organizationId: '@organizationId'
          },
          method: 'GET',
          isArray: false,
          cache: false
        },
        dashboard: {
          url: '/api/stats/dashboard',
          method: 'GET',
          isArray: false,
          cache: false
        }
      }
    );
  }

  // @ngInject
  function StatsService(StatsResource) {
    var item = { };

    return {
      data: {
        item: item
      },
      site: site,
      user: user,
      organization: organization,
      dashboard: dashboard
    };

    function site() {
      return StatsResource.site().$promise
        .then(function(response) {
          return response.$promise;
        });
    }

    function user(userId) {
      return StatsResource.user({ userId: userId}).$promise
        .then(function(response) {
          return response.$promise;
        });
    }
    function organization(organizationId) {
      return StatsResource.organization({ organizationId: organizationId}).$promise
        .then(function(response) {
          return response.$promise;
        });
    }
    function dashboard(reqObj) {
      return StatsResource.dashboard(reqObj).$promise
        .then(function(response) {
          return response.$promise;
        });
    }
  }<commit_msg>stats server saves responses to data obj<commit_after>(function() {
  'use strict';
  angular.module('civic.services')
    .factory('StatsResource', StatsResource)
    .factory('Stats', StatsService);

  // @ngInject
  function StatsResource($resource) {

    return $resource('',
      { },
      {
        site: {
          url: '/api/stats/site',
          method: 'GET',
          isArray: false,
          cache: false
        },
        user: {
          url: '/api/users/:userId/stats',
          params: {
            userId: '@userId'
          },
          method: 'GET',
          isArray: false,
          cache: false
        },
        organization: {
          url: '/api/organizations/:organizationId/stats',
          params: {
            organizationId: '@organizationId'
          },
          method: 'GET',
          isArray: false,
          cache: false
        },
        dashboard: {
          url: '/api/stats/dashboard',
          method: 'GET',
          isArray: false,
          cache: false
        }
      }
    );
  }

  // @ngInject
  function StatsService(StatsResource) {
    var item = { };

    return {
      data: {
        item: item
      },
      site: site,
      user: user,
      organization: organization,
      dashboard: dashboard
    };

    function site() {
      return StatsResource.site().$promise
        .then(function(response) {
          angular.copy(response, site);
          return response.$promise;
        });
    }

    function user(userId) {
      return StatsResource.user({ userId: userId}).$promise
        .then(function(response) {
          angular.copy(response, user);
          return response.$promise;
        });
    }
    function organization(organizationId) {
      return StatsResource.organization({ organizationId: organizationId}).$promise
        .then(function(response) {
          angular.copy(response, organization);
          return response.$promise;
        });
    }
    function dashboard(reqObj) {
      return StatsResource.dashboard(reqObj).$promise
        .then(function(response) {
          angular.copy(response, dashboar);
          return response.$promise;
        });
    }
  }
{'fraction_non_alphanumeric': 0.12532886869170054, 'fraction_numerical': 0.0, 'mean_word_length': 1.6893890675241157, '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': '4655542', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1135, 'n_words': 222}