this.use_chron = false;
this.use_alt_chron = false;
this.use_calendar_changes = false;
+ this.calendar_change = [];
this.compress_expand = '3';
this.caption_evaluation = '0';
this.enum_levels = [];
this.alt_enum_levels = [];
this.chron_levels = [];
- this.alt_chron_levels = [];
+ this.alt_chron_levels = [{ caption : null, display_caption: false }];
this.frequency_type = 'preset';
this.use_regularity = false;
this.regularity = [];
}
if (sf == 'x') {
this.use_calendar_change = true;
- this.calendar_change = [];
value.split(',').forEach(function(chg) {
var calendar_change = {
type : null,
}
}
}
+
if (self.frequency) {
if (self.frequency.match(/^\d+$/)) {
self.frequency_type = 'numeric';
return lvl.caption;
}).join(', ');
}
+
+ if (!patternCode) {
+ // starting from scratch, ensure there's
+ // enough so that the input wizard can be used
+ this.use_enum = true;
+ this.use_chron = true;
+ this.link = 0;
+ self.add_enum_level();
+ self.add_alt_enum_level();
+ self.add_chron_level();
+ self.add_calendar_change();
+ self.add_regularity();
+ }
}
// TODO chron only
- $scope.pattern = new PredictionPattern(JSON.parse($scope.patternCode));
+ if ($scope.patternCode) {
+ $scope.pattern = new PredictionPattern(JSON.parse($scope.patternCode));
+ } else {
+ $scope.pattern = new PredictionPattern();
+ }
$scope.handle_save = function() {
$scope.patternCode = JSON.stringify($scope.pattern.compile());
if (angular.isFunction($scope.onSave)) {