Skip to content

Commit

Permalink
Fix predicate form patch on refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
julianbrott committed Mar 21, 2024
1 parent 87914f9 commit bb7637b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/app/core/services/validation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ValidationService {
const request = JSON.stringify({
"behavior_description": "description",
"specification": predicate.predicateSpecification,
"specification_type": "mtl",
"specification_type": "tbv",
"predicates_info": [
predicate.predicateInfo
],
Expand Down Expand Up @@ -80,7 +80,7 @@ export class ValidationService {
const request = JSON.stringify({
"behavior_description": "description",
"specification": predicateSpecification,
"specification_type": "mtl",
"specification_type": "tbv",
"predicates_info": [
predicateFormatted
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,25 @@ export class PredicateEditDynamicComponent implements OnInit {
this.predicateForm.valueChanges
.pipe(debounceTime(400))
.subscribe(res => {
if (this.predicates) {

/* const i = this.getPredicateIndex(this.predicates, this.predicateForm.value.predicate_name);
this.predicates[i] = this.predicateForm.value;
this.validatePredicate();
this.predicatesChange.emit(this.predicateForm.value); */

const i = this.getPredicateIndex(this.predicates, this.pspElement?.predicateName!);
if (i === -1) return;
this.predicates[i] = this.predicateForm.value;
this.validatePredicate();
console.log('EMIT', this.predicates)
this.predicatesChange.emit(this.predicates);
}
this.updatePredicate();
});
}

updatePredicate() {
if (this.predicates) {
/* const i = this.getPredicateIndex(this.predicates, this.predicateForm.value.predicate_name);
this.predicates[i] = this.predicateForm.value;
this.validatePredicate();
this.predicatesChange.emit(this.predicateForm.value); */
const i = this.getPredicateIndex(this.predicates, this.pspElement?.predicateName!);
if (i === -1) return;
this.predicates[i] = this.predicateForm.value;
this.validatePredicate();
console.log('EMIT', this.predicates)
this.predicatesChange.emit(this.predicates);
}
}

initForm() {
const predicate = this.getPredicate(this.pspElement?.predicateName);
if (predicate) {
Expand Down Expand Up @@ -137,7 +139,8 @@ export class PredicateEditDynamicComponent implements OnInit {

dialogRef.afterClosed().subscribe((comparisonValue: number | null) => {
if (typeof comparisonValue === 'number' && comparisonValue !== null) {
this.predicateForm.patchValue({ fComparisonValue: comparisonValue });
this.predicateForm.patchValue({ predicate_comparison_value: comparisonValue });
this.updatePredicate();
}
});
}
Expand Down

0 comments on commit bb7637b

Please sign in to comment.