<commit_before>'use strict';

(function (angular, buildfire) {
  angular.module('eventsManualPluginWidget')
    .controller('WidgetHomeCtrl', ['$scope', 'TAG_NAMES', 'LAYOUTS', 'DataStore', 'PAGINATION', 'Buildfire', 'Location', 'EventCache', '$rootScope',
      function ($scope, TAG_NAMES, LAYOUTS, DataStore, PAGINATION, Buildfire, Location, EventCache, $rootScope) {
        console.log('Widget Home controller loaded------------------');
        var WidgetHome = this;
        WidgetHome.data = null;
        WidgetHome.swiped = [];
        WidgetHome.events = [];
        WidgetHome.allEvents = null;
        WidgetHome.busy = false;
        WidgetHome.clickEvent = false;
        WidgetHome.calledDate = null;
        $scope.dt = new Date();
        $rootScope.showFeed = true;
        $rootScope.deviceHeight = window.innerHeight;
        $rootScope.deviceWidth = window.innerWidth;
        var searchOptions = {
          skip: 0,
          limit: PAGINATION.eventsCount,
          sort: {"startDate": 1}
        };
        var currentDate = new Date();
        var formattedDate = currentDate.getFullYear() + "-" + moment(currentDate).format("MM") + "-" + ("0" + currentDate.getDate()).slice(-2) + "T00:00:00" + moment(new Date()).format("Z");
        var timeStampInMiliSec = +new Date(formattedDate);
        var currentLayout = "";
        WidgetHome.NoDataFound = false;

        WidgetHome.getUTCZone = function () {
          //return moment(new Date()).utc().format("Z");
          return moment(new Date()).format("Z")
        };

        WidgetHome.partOfTime = function (format, paramTime) {
          return moment(new Date(paramTime)).format(format);
        };

        var getManualEvents = function () {
          WidgetHome.isCalled = false;
          WidgetHome.NoDataFound = false;
          Buildfire.spinner.show();
          var successEvents = function (result) {

            if (result.length || JSON.parse(localStorage.getItem("pluginLoadedFirst"))) {
              Buildfire.spinner.hide();
              console.log("===========================", WidgetHome.events.length)
              WidgetHome.events = WidgetHome.events.length ? WidgetHome.events.concat(result) : result;

              searchOptions.skip = searchOptions.skip + PAGINATION.eventsCount;
              WidgetHome.isCalled = true;
              if (result.length <= PAGINATION.eventsCount) {
                WidgetHome.busy = false;
              }
              else {
                WidgetHome.busy = true;
              }
              WidgetHome.clickEvent = false;
              WidgetHome.isCalled = true;
            }
            else {
              if (!result.length && !JSON.parse(localStorage.getItem("pluginLoadedFirst"))) {
                WidgetHome.NoDataFound = false;
              }<commit_msg>Added some code that got deleted in merge conflict<commit_after>'use strict';

(function (angular, buildfire) {
  angular.module('eventsManualPluginWidget')
    .controller('WidgetHomeCtrl', ['$scope', 'TAG_NAMES', 'LAYOUTS', 'DataStore', 'PAGINATION', 'Buildfire', 'Location', 'EventCache', '$rootScope',
      function ($scope, TAG_NAMES, LAYOUTS, DataStore, PAGINATION, Buildfire, Location, EventCache, $rootScope) {
        console.log('Widget Home controller loaded------------------');
        var WidgetHome = this;
        WidgetHome.data = null;
        WidgetHome.swiped = [];
        WidgetHome.events = [];
        WidgetHome.allEvents = null;
        WidgetHome.busy = false;
        WidgetHome.clickEvent = false;
        WidgetHome.calledDate = null;
        $scope.dt = new Date();
        $rootScope.showFeed = true;
        $rootScope.deviceHeight = window.innerHeight;
        $rootScope.deviceWidth = window.innerWidth;
        var searchOptions = {
          skip: 0,
          limit: PAGINATION.eventsCount,
          sort: {"startDate": 1}
        };
        var currentDate = new Date();
        var formattedDate = currentDate.getFullYear() + "-" + moment(currentDate).format("MM") + "-" + ("0" + currentDate.getDate()).slice(-2) + "T00:00:00" + moment(new Date()).format("Z");
        var timeStampInMiliSec = +new Date(formattedDate);
        var currentLayout = "";
        WidgetHome.NoDataFound = false;

        WidgetHome.getUTCZone = function () {
          //return moment(new Date()).utc().format("Z");
          return moment(new Date()).format("Z")
        };

        WidgetHome.partOfTime = function (format, paramTime) {
          return moment(new Date(paramTime)).format(format);
        };

        var getManualEvents = function () {
          WidgetHome.isCalled = false;
          WidgetHome.NoDataFound = false;
          Buildfire.spinner.show();
          var successEvents = function (result) {

            if (result.length || JSON.parse(localStorage.getItem("pluginLoadedFirst"))) {
              Buildfire.spinner.hide();
              if(!WidgetHome.events){
                WidgetHome.events = [];
              }
              console.log("===========================", WidgetHome.events.length);
              WidgetHome.events = WidgetHome.events.length ? WidgetHome.events.concat(result) : result;

              searchOptions.skip = searchOptions.skip + PAGINATION.eventsCount;
              WidgetHome.isCalled = true;
              if (result.length <= PAGINATION.eventsCount) {
                WidgetHome.busy = false;
              }
              else {
                WidgetHome.busy = true;
              }
              WidgetHome.clickEvent = false;
              WidgetHome.isCalled = true;
            }
            else {
              if (!result.length && !JSON.parse(localStorage.getItem("pluginLoadedFirst"))) {
                WidgetHome.NoDataFound = false;
              }
{'fraction_non_alphanumeric': 0.14028403186698996, 'fraction_numerical': 0.0034638032559750607, 'mean_word_length': 2.1695938529088914, 'pattern_counts': {'":': 2, '<': 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': '4143447', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1547, 'n_words': 298}