Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dive Results dashboard #4

Merged
merged 39 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4a2f578
Add dive profile injection to TestData class
Jan 6, 2024
7b3eff1
Extract JSON data to TestDataJsonProvider
Jan 6, 2024
a001a47
Add more testing dives
Jan 6, 2024
bc23699
Inject 2 dive profiles
Jan 6, 2024
acb724e
Extract test data injection into service
Jan 6, 2024
4848f6e
Add ProfileComparatorService
Jan 7, 2024
db8dd45
Add check for at least 2 profiles
Jan 7, 2024
798dc11
Extract test data injection into component
Jan 7, 2024
7e05c01
Fix LoadTestDataComponent.isLoaded
Jan 7, 2024
ec6fd46
Lower LoadTestDataComponent vertical position
Jan 7, 2024
96efd49
Rework WaypointsComparisonTableRowProvider into injectable service
Jan 7, 2024
970e028
Change date formatter to 'duration'
Jan 7, 2024
a0615d8
Add Calculating component
Jan 7, 2024
26ec52d
Remove TestData
Jan 7, 2024
734c91a
Fix for changed PlannerService.calculate signature
Jan 27, 2024
759b46b
Add placeholder component for Dive Info - Results
Jan 27, 2024
b4def78
Add code from original diveinfo component
Jan 27, 2024
04829e0
Move table to diff-diveinfo-results component
Jan 27, 2024
4f2d344
Support multiple profiles in DiveInfoResultsDifference
Jan 27, 2024
bc008f7
Rename methods to better reflect usage
Feb 4, 2024
894c402
Rename methods for clarity of returned result
Feb 4, 2024
969388a
Remove commented code
Feb 4, 2024
8f60a4b
Add profile B results to table
Feb 4, 2024
8bde1c7
Unify formatting
Feb 4, 2024
6a375fc
Make Dive Info into Dive Results
Feb 4, 2024
4e5d2a2
Resize cards into 2x2 grid
Feb 5, 2024
0e439dd
Add deltas to Dive Results table
Feb 5, 2024
1e764b8
Add dynamic background coloring to delta column
Feb 9, 2024
4d3a301
Add header and CSS style
Feb 9, 2024
416e0a0
Load diff column only when data is loaded
Feb 9, 2024
dfcccc3
Remove commented code
Feb 9, 2024
d84dc6c
Comment out test data injection
Feb 9, 2024
b281621
Fix incorrect coloring if difference is 0
Feb 9, 2024
5bbb534
Fix waypoints table styling
Feb 9, 2024
c23c6fa
Replace console.error with Logger
Feb 11, 2024
c5458d8
Introduce constants instead of hidden strings
Feb 11, 2024
120063a
Set default profile as initial indexes for diff
Feb 11, 2024
d91d2ae
Remove requirement of 2+ profiles to initiate diff
Feb 11, 2024
bbbf2f9
Add stretch TODO
Feb 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 100 additions & 90 deletions projects/planner/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,94 +1,99 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { ServiceWorkerModule } from '@angular/service-worker';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { DatePipe, DecimalPipe } from '@angular/common';
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
xlebod marked this conversation as resolved.
Show resolved Hide resolved
import {ReactiveFormsModule} from '@angular/forms';
import {ServiceWorkerModule} from '@angular/service-worker';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {DatePipe, DecimalPipe} from '@angular/common';

import { ClipboardModule } from 'ngx-clipboard';
import { MdbCollapseModule } from 'mdb-angular-ui-kit/collapse';
import { MdbDropdownModule } from 'mdb-angular-ui-kit/dropdown';
import { MdbFormsModule } from 'mdb-angular-ui-kit/forms';
import { MdbTabsModule } from 'mdb-angular-ui-kit/tabs';
import { MdbAccordionModule } from 'mdb-angular-ui-kit/accordion';
import {ClipboardModule} from 'ngx-clipboard';
import {MdbCollapseModule} from 'mdb-angular-ui-kit/collapse';
import {MdbDropdownModule} from 'mdb-angular-ui-kit/dropdown';
import {MdbFormsModule} from 'mdb-angular-ui-kit/forms';
import {MdbTabsModule} from 'mdb-angular-ui-kit/tabs';
import {MdbAccordionModule} from 'mdb-angular-ui-kit/accordion';

import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { TanksSimpleComponent } from './tanks-simple/tanks-simple.component';
import { TanksComplexComponent } from './tanks-complex/tanks-complex.component';
import { DiverComponent } from './diver/diver.component';
import { DiveOptionsComponent } from './diveoptions/diveoptions.component';
import { DiveInfoComponent } from './diveinfo/diveinfo.component';
import { MainMenuComponent } from './mainmenu/mainmenu.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { GaslabelComponent } from './gaslabel/gaslabel.component';
import { SacComponent } from './sac/sac.component';
import { NitroxComponent } from './nitrox/nitrox.component';
import { WayPointsComponent } from './waypoints/waypoints.component';
import { ProfileChartComponent } from './profilechart/profilechart.component';
import { AboutComponent } from './about/about.component';
import { AppFooterComponent } from './footer/footer.component';
import { DepthsSimpleComponent } from './depths-simple/depths-simple.component';
import { DepthsComplexComponent } from './depths-complex/depths-complex.component';
import { TankChartComponent } from './tank-chart/tank-chart.component';
import { AppSettingsComponent } from './app-settings/app-settings.component';
import { CalculatingComponent } from './calculating/calculating.component';
import { NdlLimitsComponent } from './ndl-limits/ndl-limits.component';
import { SalinityComponent } from './salinity/salinity.component';
import { AltitudeComponent } from './altitude/altitude.component';
import { GradientsComponent } from './gradients/gradients.component';
import { DepthComponent } from './depth/depth.component';
import { OxygenComponent } from './oxygen/oxygen.component';
import {environment} from '../environments/environment';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {TanksSimpleComponent} from './tanks-simple/tanks-simple.component';
import {TanksComplexComponent} from './tanks-complex/tanks-complex.component';
import {DiverComponent} from './diver/diver.component';
import {DiveOptionsComponent} from './diveoptions/diveoptions.component';
import {DiveInfoComponent} from './diveinfo/diveinfo.component';
import {MainMenuComponent} from './mainmenu/mainmenu.component';
import {DashboardComponent} from './dashboard/dashboard.component';
import {GaslabelComponent} from './gaslabel/gaslabel.component';
import {SacComponent} from './sac/sac.component';
import {NitroxComponent} from './nitrox/nitrox.component';
import {WayPointsComponent} from './waypoints/waypoints.component';
import {ProfileChartComponent} from './profilechart/profilechart.component';
import {AboutComponent} from './about/about.component';
import {AppFooterComponent} from './footer/footer.component';
import {DepthsSimpleComponent} from './depths-simple/depths-simple.component';
import {DepthsComplexComponent} from './depths-complex/depths-complex.component';
import {TankChartComponent} from './tank-chart/tank-chart.component';
import {AppSettingsComponent} from './app-settings/app-settings.component';
import {CalculatingComponent} from './calculating/calculating.component';
import {NdlLimitsComponent} from './ndl-limits/ndl-limits.component';
import {SalinityComponent} from './salinity/salinity.component';
import {AltitudeComponent} from './altitude/altitude.component';
import {GradientsComponent} from './gradients/gradients.component';
import {DepthComponent} from './depth/depth.component';
import {OxygenComponent} from './oxygen/oxygen.component';

import { DurationPipe } from './pipes/duration.pipe';
import { PlannerService } from './shared/planner.service';
import { PreferencesStore } from './shared/preferencesStore';
import { UnitConversion } from './shared/UnitConversion';
import { SelectedWaypoint } from './shared/selectedwaypointService';
import { WorkersFactory } from './shared/workers.factory';
import { WorkersFactoryCommon } from './shared/serial.workers.factory';
import { NdlService } from './shared/ndl.service';
import { OptionsService } from './shared/options.service';
import { PpO2Component } from './pp-o2/pp-o2.component';
import { DelayedScheduleService } from './shared/delayedSchedule.service';
import { AppinfoComponent } from './appinfo/appinfo.component';
import { DiveIssuesComponent } from './dive-issues/dive-issues.component';
import { InputControls } from './shared/inputcontrols';
import { ValidatorGroups } from './shared/ValidatorGroups';
import { DepthsService } from './shared/depths.service';
import { TanksService } from './shared/tanks.service';
import { SacCalculatorService } from './shared/sac-calculator.service';
import { NitroxCalculatorService } from './shared/nitrox-calculator.service';
import { SettingsNormalizationService } from './shared/settings-normalization.service';
import { ViewSwitchService } from './shared/viewSwitchService';
import { OxygenDropDownComponent } from './oxygen-dropdown/oxygen-dropdown.component';
import { Preferences } from './shared/preferences';
import { PlanUrlSerialization } from './shared/PlanUrlSerialization';
import { WayPointsService } from './shared/waypoints.service';
import { PlanTabsComponent } from './plan.tabs/plan.tabs.component';
import { TankSizeComponent } from './tank.size/tank.size.component';
import { StopsFilter } from './shared/stopsFilter.service';
import { ViewStates } from './shared/viewStates';
import { Urls } from './shared/navigation.service';
import { SubViewStorage } from './shared/subViewStorage';
import { DashboardStartUp } from './shared/startUp';
import { AltitudeCalcComponent } from './altitude-calc/altitude-calc.component';
import { WeightCalcComponent } from './weight/weight.component';
import { GasPropertiesCalcComponent } from './gas.props/gas.props.component';
import { DiffComponent } from './diff/diff.component';
import { DiveResults } from './shared/diveresults';
import { DiveSchedules } from './shared/dive.schedules';
import { RedundanciesComponent } from './redundancies/redundancies.component';
import { RedundanciesService } from './shared/redundancies.service';
import { ReloadDispatcher } from './shared/reloadDispatcher';
import { ManagedDiveSchedules } from './shared/managedDiveSchedules';
import { WaypointsDifferenceComponent } from './diff/waypoints/diff-waypoints.component';
import { DiveInfoDifferenceComponent } from './diff/diveinfo/diff-diveinfo.component';
import { ProfileDifferenceChartComponent } from './diff/profilechart/diff-profilechart.component';
import { MaskitoModule } from '@maskito/angular';
import { SurfaceIntervalComponent } from './surface-interval/surface-interval.component';
import {DurationPipe} from './pipes/duration.pipe';
import {PlannerService} from './shared/planner.service';
import {PreferencesStore} from './shared/preferencesStore';
import {UnitConversion} from './shared/UnitConversion';
import {SelectedWaypoint} from './shared/selectedwaypointService';
import {WorkersFactory} from './shared/workers.factory';
import {WorkersFactoryCommon} from './shared/serial.workers.factory';
import {NdlService} from './shared/ndl.service';
import {OptionsService} from './shared/options.service';
import {PpO2Component} from './pp-o2/pp-o2.component';
import {DelayedScheduleService} from './shared/delayedSchedule.service';
import {AppinfoComponent} from './appinfo/appinfo.component';
import {DiveIssuesComponent} from './dive-issues/dive-issues.component';
import {InputControls} from './shared/inputcontrols';
import {ValidatorGroups} from './shared/ValidatorGroups';
import {DepthsService} from './shared/depths.service';
import {TanksService} from './shared/tanks.service';
import {SacCalculatorService} from './shared/sac-calculator.service';
import {NitroxCalculatorService} from './shared/nitrox-calculator.service';
import {SettingsNormalizationService} from './shared/settings-normalization.service';
import {ViewSwitchService} from './shared/viewSwitchService';
import {OxygenDropDownComponent} from './oxygen-dropdown/oxygen-dropdown.component';
import {Preferences} from './shared/preferences';
import {PlanUrlSerialization} from './shared/PlanUrlSerialization';
import {WayPointsService} from './shared/waypoints.service';
import {PlanTabsComponent} from './plan.tabs/plan.tabs.component';
import {TankSizeComponent} from './tank.size/tank.size.component';
import {StopsFilter} from './shared/stopsFilter.service';
import {ViewStates} from './shared/viewStates';
import {Urls} from './shared/navigation.service';
import {SubViewStorage} from './shared/subViewStorage';
import {DashboardStartUp} from './shared/startUp';
import {AltitudeCalcComponent} from './altitude-calc/altitude-calc.component';
import {WeightCalcComponent} from './weight/weight.component';
import {GasPropertiesCalcComponent} from './gas.props/gas.props.component';
import {DiffComponent} from './diff/diff.component';
import {DiveResults} from './shared/diveresults';
import {DiveSchedules} from './shared/dive.schedules';
import {RedundanciesComponent} from './redundancies/redundancies.component';
import {RedundanciesService} from './shared/redundancies.service';
import {ReloadDispatcher} from './shared/reloadDispatcher';
import {ManagedDiveSchedules} from './shared/managedDiveSchedules';
import {WaypointsDifferenceComponent} from './diff/waypoints/diff-waypoints.component';
import {DiveInfoDifferenceComponent} from './diff/diveinfo/diff-diveinfo.component';
import {ProfileDifferenceChartComponent} from './diff/profilechart/diff-profilechart.component';
import {MaskitoModule} from '@maskito/angular';
import {SurfaceIntervalComponent} from './surface-interval/surface-interval.component';
import {TestDataInjector} from './diff/testData/testDataInjector';
import {ProfileComparatorService} from './shared/profileComparatorService';
import {LoadTestDataComponent} from './diff/testData/loadtestdata/loadtestdata.component';
import {WaypointsDifferenceService} from './shared/waypoints-difference.service';
import {DiveInfoResultsDifferenceComponent} from './diff/diveinfo/results/diff-diveinfo-results.component';

const ANGULAR_MODULES = [
AppRoutingModule,
Expand Down Expand Up @@ -148,7 +153,9 @@ const COMPONENTS = [
WeightCalcComponent,
WaypointsDifferenceComponent,
DiveInfoDifferenceComponent,
ProfileDifferenceChartComponent
ProfileDifferenceChartComponent,
LoadTestDataComponent,
DiveInfoResultsDifferenceComponent
];

const SERVICES = [
Expand Down Expand Up @@ -182,7 +189,10 @@ const SERVICES = [
ValidatorGroups,
ViewStates,
ViewSwitchService,
WayPointsService
WayPointsService,
TestDataInjector,
ProfileComparatorService,
WaypointsDifferenceService
];

@NgModule({
Expand Down
11 changes: 6 additions & 5 deletions projects/planner/src/app/diff/diff.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<!--<app-loadtestdata></app-loadtestdata>-->

<div class="mt-5">
<div class="row">
<div class="col-12 col-lg-12 col-xl-6 col-xxl-6 mt-4">
<div class="col-12 col-xl-6 col-xxl-6 mt-4">
<app-diff-profilechart></app-diff-profilechart>
</div>
<div class="col-md-6 col-xl-6 mt-4">
<app-diff-waypoints [data]="testData"></app-diff-waypoints>
<div class="col-xl-6 mt-4">
<app-diff-waypoints></app-diff-waypoints>
</div>
<div class="col-md-6 col-xl-5 col-xxl-3 mt-4">
<div class="col-xl-6 col-xxl-6 mt-4">
<app-diff-diveinfo></app-diff-diveinfo>
</div>
</div>
</div>

16 changes: 13 additions & 3 deletions projects/planner/src/app/diff/diff.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { DiffComponent } from './diff.component';
import {DiffComponent} from './diff.component';
import {ProfileComparatorService} from '../shared/profileComparatorService';
import {DiveSchedules} from '../shared/dive.schedules';
import {UnitConversion} from '../shared/UnitConversion';
import {ReloadDispatcher} from '../shared/reloadDispatcher';

describe('DiffComponent', () => {
let component: DiffComponent;
let fixture: ComponentFixture<DiffComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [DiffComponent]
declarations: [DiffComponent],
providers: [
ProfileComparatorService,
DiveSchedules,
UnitConversion,
ReloadDispatcher
]
});
fixture = TestBed.createComponent(DiffComponent);
component = fixture.componentInstance;
Expand Down
55 changes: 3 additions & 52 deletions projects/planner/src/app/diff/diff.component.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,12 @@
import {Component} from '@angular/core';
import {WayPointsService} from '../shared/waypoints.service';
import {UnitConversion} from '../shared/UnitConversion';
import {Segments, StandardGases, Tank, Time} from 'scuba-physics';
import {WayPoint} from '../shared/models';

export class TestData {
public readonly wayPointsA: WayPoint[];
public readonly tanksA: Tank[];

public readonly wayPointsB: WayPoint[];
public readonly tanksB: Tank[];

constructor() {
const units = new UnitConversion();
const waypointService = new WayPointsService(units);

this.tanksA = [
new Tank(24, 200, 21),
new Tank(11, 200, 50),
new Tank(11, 150, 100),
];
this.tanksA[0].consumed = 120;
this.tanksA[1].consumed = 80;
this.tanksA[2].consumed = 60;

const segmentsA = new Segments();
segmentsA.add(0, 40, StandardGases.air, Time.oneMinute * 2);
segmentsA.add(40, 40, StandardGases.air, Time.oneMinute * 10);
segmentsA.add(40, 21, StandardGases.air, Time.oneMinute * 2);
segmentsA.add(21, 21, StandardGases.ean50, Time.oneMinute);
segmentsA.add(21, 3, StandardGases.ean50, Time.oneMinute * 3);
segmentsA.add(3, 3, StandardGases.oxygen, Time.oneMinute * 6);
segmentsA.add(3, 0, StandardGases.oxygen, Time.oneMinute);
this.wayPointsA = waypointService.calculateWayPoints(segmentsA.items);

this.tanksB = [
new Tank(24, 200, 21),
new Tank(11, 200, 50)
];
this.tanksB[0].consumed = 90;
this.tanksB[1].consumed = 40;

const segmentsB = new Segments();
segmentsB.add(0, 30, StandardGases.air, Time.oneMinute * 4);
segmentsB.add(30, 30, StandardGases.air, Time.oneMinute * 10);
segmentsB.add(30, 15, StandardGases.air, Time.oneMinute * 3);
segmentsB.add(15, 15, StandardGases.ean50, Time.oneMinute);
segmentsB.add(15, 0, StandardGases.ean50, Time.oneMinute * 2);
this.wayPointsB = waypointService.calculateWayPoints(segmentsB.items);
}
}
import {ProfileComparatorService} from '../shared/profileComparatorService';

@Component({
selector: 'app-diff',
templateUrl: './diff.component.html',
styleUrls: ['./diff.component.scss']
})
export class DiffComponent {
public testData = new TestData();
constructor(public profileComparatorService: ProfileComparatorService) {
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
<app-diveinfo></app-diveinfo>
<div class="card">
<div class="card-header">
<div class="float-start mt-1">
<fa-icon [icon]="icon" class="me-3"></fa-icon>
<span>Dive Results</span>
</div>
</div>

<div class="card-body card-minheight">
<div class="pb-3">
<app-diff-diveinfo-results></app-diff-diveinfo-results>
</div>
</div>
</div>

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { DiveInfoDifferenceComponent } from './diff-diveinfo.component';
import {DiveInfoDifferenceComponent} from './diff-diveinfo.component';

describe('DiveInfoDifferenceComponent', () => {
let component: DiveInfoDifferenceComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';
import {faSlidersH} from '@fortawesome/free-solid-svg-icons';

@Component({
selector: 'app-diff-diveinfo',
templateUrl: './diff-diveinfo.component.html',
styleUrls: ['./diff-diveinfo.component.scss']
})
export class DiveInfoDifferenceComponent {

public icon = faSlidersH;
}
Loading
Loading