Skip to content

Commit

Permalink
Distinguished calculated results in diff
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Apr 5, 2024
1 parent 6969fb3 commit fa70de9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

<div class="card-body card-minheight card-max-height-md">
<div class="pb-3">
<app-diff-gas-consumed-tank-chart *ngFor="let gasDiff of gasesDifference" [gasDiff]="gasDiff">
</app-diff-gas-consumed-tank-chart>
<ng-container *ngIf="profileDif.showConsumption">
<app-diff-gas-consumed-tank-chart *ngFor="let gasDiff of gasesDifference" [gasDiff]="gasDiff">
</app-diff-gas-consumed-tank-chart>
</ng-container>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import { faSlidersH } from '@fortawesome/free-solid-svg-icons';
import { GasesComparisonService, ConsumedGasDifference } from '../../../shared/diff/gases-comparison.service';
import { ProfileComparatorService } from '../../../shared/diff/profileComparatorService';

@Component({
selector: 'app-diff-gas-consumed',
Expand All @@ -10,7 +11,7 @@ import { GasesComparisonService, ConsumedGasDifference } from '../../../shared/d
export class GasConsumedDifferenceComponent {
public icon = faSlidersH;

constructor(public gasesDiff: GasesComparisonService) {
constructor(public profileDif: ProfileComparatorService, public gasesDiff: GasesComparisonService) {
}

public get gasesDifference(): ConsumedGasDifference[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</div>
</div>
<div id="body" class="hide card-minheight card-max-height-md">
<app-calculating [show]="!profileDiff.bothResultsCalculated"></app-calculating>
<app-calculating [show]="!profileDiff.profilesCalculated"></app-calculating>

<table *ngIf="profileDiff.bothResultsCalculated"
<table *ngIf="profileDiff.profilesCalculated"
id="waypointsDiffTable" class="table table-sm p-0 text-center table-hover" >
<thead class="table-light sticky-top">
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class ProfileComparatorService extends Streamed {
return this.profileAResults.profileCalculated && this.profileBResults.profileCalculated;
}

public get showConsumption(): boolean {
return this.profileAResults.showResults && this.profileBResults.showResults;
}

private get wayPointsA(): WayPoint[]{
return this.profileAResults.wayPoints;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,25 @@ describe('ProfileComparison service', () => {
expect(sut.profilesCalculated).toBeFalsy();
});

it('Profiles are already calculated', () => {
// TODO distinguish profile calculated, consumption and diveInfo
it('Dive profiles are already calculated', () => {
sut.profileAResults.profileFinished();
sut.profileBResults.profileFinished();
expect(sut.profilesCalculated).toBeTruthy();
});

it('Dive results are already calculated', () => {
sut.profileAResults.diveInfoFinished();
sut.profileAResults.consumptionFinished();
sut.profileBResults.diveInfoFinished();
sut.profileBResults.consumptionFinished();
expect(sut.bothResultsCalculated).toBeTruthy();
});

it('Consumption are already calculated', () => {
sut.profileAResults.consumptionFinished();
sut.profileBResults.consumptionFinished();
expect(sut.showConsumption).toBeTruthy();
});
});

describe('Select new profile', () => {
Expand Down

0 comments on commit fa70de9

Please sign in to comment.