<commit_before>angular.module(PKG.name + '.feature.workflows')
  .controller('WorkflowsSchedulesController', function($scope, MyDataSource, $state) {
    var dataSrc = new MyDataSource($scope);


    dataSrc.request({
      _cdapNsPath: '/apps/' + $state.params.appId +
                    '/workflows/' + $state.params.programId + '/schedules'
    })
    .then(function (res) {
      $scope.schedules = res;

      angular.forEach($scope.schedules, function(v) {
        if (v.scheduleType === 'TIME') {
          console.log('test');
          var parse = v.schedule.cronExpression.split(' ');
          v.time = {};
          v.time.min = parse[0];
          v.time.hour = parse[1];
          v.time.day = parse[2];
          v.time.month = parse[3];
          v.time.week = parse[4];
        }
        v.isOpen = false;

        dataSrc.poll({
          _cdapNsPath: '/apps/' + $state.params.appId +
                        '/schedules/' + v.schedule.name + '/status'
        }, function (response) {
          v.status = response.status;
        });
      });

      $scope.schedules[0].isOpen = true;

    });

    $scope.suspendSchedule = function (obj) {
      dataSrc.request({
        _cdapNsPath: '/apps/' + $state.params.appId +
                      '/schedules/' + obj.schedule.name + '/suspend',
        method: 'POST'
      });
    };
<commit_msg>checking if there is no schedule before opening accordion<commit_after>angular.module(PKG.name + '.feature.workflows')
  .controller('WorkflowsSchedulesController', function($scope, MyDataSource, $state) {
    var dataSrc = new MyDataSource($scope);


    dataSrc.request({
      _cdapNsPath: '/apps/' + $state.params.appId +
                    '/workflows/' + $state.params.programId + '/schedules'
    })
    .then(function (res) {
      $scope.schedules = res;

      angular.forEach($scope.schedules, function(v) {
        if (v.scheduleType === 'TIME') {
          console.log('test');
          var parse = v.schedule.cronExpression.split(' ');
          v.time = {};
          v.time.min = parse[0];
          v.time.hour = parse[1];
          v.time.day = parse[2];
          v.time.month = parse[3];
          v.time.week = parse[4];
        }
        v.isOpen = false;

        dataSrc.poll({
          _cdapNsPath: '/apps/' + $state.params.appId +
                        '/schedules/' + v.schedule.name + '/status'
        }, function (response) {
          v.status = response.status;
        });
      });

      if ($scope.schedules.length > 0) {
        $scope.schedules[0].isOpen = true;
      }

    });

    $scope.suspendSchedule = function (obj) {
      dataSrc.request({
        _cdapNsPath: '/apps/' + $state.params.appId +
                      '/schedules/' + obj.schedule.name + '/suspend',
        method: 'POST'
      });
    };

{'fraction_non_alphanumeric': 0.16164480680609714, 'fraction_numerical': 0.004608294930875576, 'mean_word_length': 1.8418932527693856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2403680', 'n_tokens_mistral': 885, 'n_tokens_neox': 864, 'n_words': 147}