<commit_before>/* global Rickshaw:false */
(function () {
  'use strict';

  angular.module('app.session')
    .controller('session.Dashboard', ['$ExceptionlessClient', 'eventService', '$filter', 'filterService', 'notificationService', 'organizationService', 'statService', function ($ExceptionlessClient, eventService, $filter, filterService, notificationService, organizationService, statService) {
      var source = 'app.session.Dashboard';
      var vm = this;

      function get() {
        function onSuccess(response) {
          vm.stats = response.data.plain();
          if (!vm.stats.timeline) {
            vm.stats.timeline = [];
          }

          vm.chart.options.series[0].data = vm.stats.timeline.map(function (item) {
            return {x: moment.utc(item.date).unix(), y: item.sessions, data: item};
          });
        }

        function onFailure() {
          notificationService.error('An error occurred while loading the stats.');
        }

        var options = {};
        return statService.getSessions(options).then(onSuccess, onFailure);
      }

      vm.chart = {
        options: {
          renderer: 'stack',
          stroke: true,
          padding: {top: 0.085},
          series: [{
            name: 'Sessions',
            color: 'rgba(124, 194, 49, .9)',
            stroke: 'rgba(0, 0, 0, 0.15)'
          }]
        },
        features: {
          hover: {
            render: function (args) {
              var date = moment.unix(args.domainX);
              var formattedDate = date.hours() === 0 && date.minutes() === 0 ? date.format('ddd, MMM D, YYYY') : date.format('ddd, MMM D, YYYY h:mma');
              var content = '<div class="date">' + formattedDate + '</div>';
              args.detail.sort(function (a, b) {<commit_msg>Fixes #70 Added users to sessions page chart<commit_after>/* global Rickshaw:false */
(function () {
  'use strict';

  angular.module('app.session')
    .controller('session.Dashboard', ['$ExceptionlessClient', 'eventService', '$filter', 'filterService', 'notificationService', 'organizationService', 'statService', function ($ExceptionlessClient, eventService, $filter, filterService, notificationService, organizationService, statService) {
      var source = 'app.session.Dashboard';
      var vm = this;

      function get() {
        function onSuccess(response) {
          vm.stats = response.data.plain();
          if (!vm.stats.timeline) {
            vm.stats.timeline = [];
          }

          vm.chart.options.series[0].data = vm.stats.timeline.map(function (item) {
            return {x: moment.utc(item.date).unix(), y: item.users, data: item};
          });

          vm.chart.options.series[1].data = vm.stats.timeline.map(function (item) {
            return {x: moment.utc(item.date).unix(), y: item.sessions, data: item};
          });
        }

        function onFailure() {
          notificationService.error('An error occurred while loading the stats.');
        }

        var options = {};
        return statService.getSessions(options).then(onSuccess, onFailure);
      }

      vm.chart = {
        options: {
          renderer: 'stack',
          stroke: true,
          padding: {top: 0.085},
          series: [{
              name: 'Users',
              color: 'rgba(60, 116, 0, .9)',
              stroke: 'rgba(0, 0, 0, 0.15)'
            }, {
              name: 'Sessions',
              color: 'rgba(124, 194, 49, .9)',
              stroke: 'rgba(0, 0, 0, 0.15)'
            }
          ]
        },
        features: {
          hover: {
            render: function (args) {
              var date = moment.unix(args.domainX);
              var formattedDate = date.hours() === 0 && date.minutes() === 0 ? date.format('ddd, MMM D, YYYY') : date.format('ddd, MMM D, YYYY h:mma');
              var content = '<div class="date">' + formattedDate + '</div>';
              args.detail.sort(function (a, b) {
{'fraction_non_alphanumeric': 0.15252090195084875, 'fraction_numerical': 0.015201418799087915, 'mean_word_length': 2.079563182527301, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '354372', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1129, 'n_words': 261}