Fix duplicate condition and displaying min twice instead of min and max value
All checks were successful
E2E Testing / test (push) Successful in 1m35s

This commit is contained in:
Sebastian Böckelmann 2024-02-18 17:17:39 +01:00
parent 80dcfb33bf
commit 79eee273a0
2 changed files with 3 additions and 4 deletions

View File

@ -26,7 +26,7 @@
<ng-container matColumnDef="maxValue"> <ng-container matColumnDef="maxValue">
<th mat-header-cell *matHeaderCellDef>Maximal Value</th> <th mat-header-cell *matHeaderCellDef>Maximal Value</th>
<td mat-cell *matCellDef="let condition"> <td mat-cell *matCellDef="let condition">
<span *ngIf="condition !== editedCondition && condition !== addedCondition">{{condition.minValue}}</span> <span *ngIf="condition !== editedCondition && condition !== addedCondition">{{condition.maxValue}}</span>
<mat-form-field appearance="fill" class="long-form" *ngIf=" condition === editedCondition"> <mat-form-field appearance="fill" class="long-form" *ngIf=" condition === editedCondition">
<mat-label>Maximal Value</mat-label> <mat-label>Maximal Value</mat-label>
<input matInput [(ngModel)]="editedCondition!.maxValue"> <input matInput [(ngModel)]="editedCondition!.maxValue">

View File

@ -29,16 +29,15 @@ export class ScriptaccountConditionEditorComponent implements OnInit{
this.addedCondition = ScriptAccountCondition.constructScriptAccountCondition(new ScriptAccount("", ""), 0,0); this.addedCondition = ScriptAccountCondition.constructScriptAccountCondition(new ScriptAccount("", ""), 0,0);
this.editedCondition = this.addedCondition; this.editedCondition = this.addedCondition;
this.dataSource.data = this.dataSource.data.concat(this.addedCondition!); this.dataSource.data = this.dataSource.data.concat(this.addedCondition!);
console.log(this.dataSource.data.length)
console.log(this.conditions.length)
} }
finishEditing() { finishEditing() {
if(this.addedCondition != undefined) { if(this.addedCondition != undefined) {
const createdCondition = ScriptAccountCondition.constructScriptAccountCondition(this.addedCondition.scriptAccount, this.addedCondition.minValue, this.addedCondition.maxValue); const createdCondition = ScriptAccountCondition.constructScriptAccountCondition(this.addedCondition.scriptAccount, this.addedCondition.minValue, this.addedCondition.maxValue);
if(createdCondition != undefined) { if(createdCondition != undefined) {
console.log(createdCondition)
this.onCreateCondition.emit(createdCondition); this.onCreateCondition.emit(createdCondition);
this.conditions.push(createdCondition); console.log(this.conditions)
this.dataSource.data = this.conditions; this.dataSource.data = this.conditions;
} }
this.addedCondition = undefined; this.addedCondition = undefined;