Skip to content

Commit

Permalink
Merge pull request #1026 from hpi-sam/release/v0.7.0
Browse files Browse the repository at this point in the history
Release v0.7.0
  • Loading branch information
Greenscreen23 authored May 30, 2023
2 parents 991abf7 + dfca38c commit 0e30049
Show file tree
Hide file tree
Showing 220 changed files with 4,505 additions and 866 deletions.
6 changes: 2 additions & 4 deletions .eslint/typescript.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ module.exports = {
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/no-type-alias': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
// Disabled because of incorrect typings from libraries and
// checks after type assertions without `undefined` in the type
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
Expand Down Expand Up @@ -399,6 +397,6 @@ module.exports = {
],
'@typescript-eslint/no-misused-new': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
},
};
35 changes: 34 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@ and this project does **not** adhere to [Semantic Versioning](https://semver.org

## [Unreleased]

## [0.7.0] - 2023-05-30

### Added

- Statistics can now also be restricted to simulated regions.
- Add functionality to create logs for statistics.
- Add a button that allows trainers to move the map to any coordinates of their choice.
- Log entries are now displayed on the statistics page and can be filtered.
- Log entries are being generated for the following actions:
- Publishing, accepting and marking radiograms as done.
- Accepting or denying resource request radiograms.
- Vehicle and Patient addition and deletion
- AlarmGroup sent
- Addition of elements to transfer
- Edit or pause of transfer
- All configuration of the simulation
- Addition of elements to simulated regions
- Connection and disconnection of transfer points and hospitals
- Log entries are being generated for the following occurrences:
- Completion of transfer
- Treatment status changes.
- Completion of the transfer of patients of one category
- Either in one region or in all regions managed by one behavior
- Vehicle transfer, loading, unloading and occupation changes.
- Visible status changes of patients.
- Treating personnel changes for patients.
- By clicking on a log entry or a chart, a marker will be shown in the chart at that time. The log entry list scrolls to that time.

### Fixed

- Errors in reduction of the tick actions no longer crash the backend.

## [0.6.0] - 2023-05-17

### Added
Expand Down Expand Up @@ -230,7 +262,8 @@ and this project does **not** adhere to [Semantic Versioning](https://semver.org

### Initial unstable release of Digitale FüSim MANV

[Unreleased]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.6.0...HEAD
[Unreleased]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/hpi-sam/digital-fuesim-manv/compare/v0.4.0...v0.5.0
Expand Down
12 changes: 6 additions & 6 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "digital-fuesim-manv-backend",
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"scripts": {
"start:once:linux-macos": "NODE_ENV=production node --experimental-specifier-resolution=node dist/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/exercise/action-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class ActionWrapper extends NormalType<
);
}

public readonly index!: number;
public readonly index: number;

/**
* @param emitterId `null` iff the emitter was the server, the client id otherwise
Expand Down
53 changes: 35 additions & 18 deletions backend/src/exercise/exercise-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,41 @@ export class ExerciseWrapper extends NormalType<
* All periodic actions of the exercise (e.g. status changes for patients) should happen here.
*/
private readonly tick = async () => {
const patientUpdates = patientTick(
this.getStateSnapshot(),
this.tickInterval
);
const updateAction: ExerciseAction = {
type: '[Exercise] Tick',
patientUpdates,
/**
* Refresh every {@link refreshTreatmentInterval} * {@link tickInterval} ms seconds
*/
// TODO: Refactor this: do this in the reducer instead of sending it in the action
refreshTreatments:
this.tickCounter % this.refreshTreatmentInterval === 0,
tickInterval: this.tickInterval,
};
this.applyAction(updateAction, this.emitterId);
this.tickCounter++;
this.markAsModified();
try {
const patientUpdates = patientTick(
this.getStateSnapshot(),
this.tickInterval
);
const updateAction: ExerciseAction = {
type: '[Exercise] Tick',
patientUpdates,
/**
* Refresh every {@link refreshTreatmentInterval} * {@link tickInterval} ms seconds
*/
// TODO: Refactor this: do this in the reducer instead of sending it in the action
refreshTreatments:
this.tickCounter % this.refreshTreatmentInterval === 0,
tickInterval: this.tickInterval,
};
this.applyAction(updateAction, this.emitterId);
this.tickCounter++;
this.markAsModified();
} catch (e: unknown) {
// Something went wrong in tick, probably some corrupted simulation state.
console.error(e);
try {
this.applyAction(
{
type: '[Exercise] Pause',
},
this.emitterId
);
this.markAsModified();
} catch {
// Alright, this is enough. Something is fundamentally broken.
this.pause();
}
}
};

// Call the tick every 1000 ms
Expand Down
6 changes: 3 additions & 3 deletions benchmark/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "digital-fuesim-manv-benchmark",
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"scripts": {
"lint": "eslint --max-warnings 0 --ignore-path .gitignore \"./**/*.{ts,js,yml,html}\"",
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Digital Fuesim MANV HTTP API
description: HTTP API of the digital-fuesim-manv project
version: 0.6.0
version: 0.7.0
paths:
/api/health:
get:
Expand Down
11 changes: 6 additions & 5 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "digital-fuesim-manv-frontend",
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"scripts": {
"cy:open": "cypress open",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/core/time-travel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class TimeTravelService {
});
// Freeze to prevent accidental modification
freeze(exerciseTimeLine, true);
// False positive, could be changed by the `catch`
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!this.activatingTimeTravel) {
// The timeTravel has been stopped during the retrieval of the timeline
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class CustomTimerProgressBarComponent implements OnChanges, OnDestroy {
}

ngOnChanges(changes: SimpleChangesGeneric<this>) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (changes.timer) {
this.animationParams$.next(undefined);
this.timer$.next(this.timer);
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/pages/exercises/exercise/exercise.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { TimeTravelComponent } from './shared/time-travel/time-travel.component'
import { TrainerMapEditorComponent } from './shared/trainer-map-editor/trainer-map-editor.component';
import { TrainerToolbarComponent } from './shared/trainer-toolbar/trainer-toolbar.component';
import { TransferOverviewModule } from './shared/transfer-overview/transfer-overview.module';
import { CoordinatePickerModule } from './shared/coordinate-picker/coordinate-picker.module';

@NgModule({
declarations: [
Expand All @@ -46,6 +47,7 @@ import { TransferOverviewModule } from './shared/transfer-overview/transfer-over
AlarmGroupOverviewModule,
HospitalEditorModule,
EmergencyOperationsCenterModule,
CoordinatePickerModule,
],
exports: [ExerciseComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class ExerciseComponent implements OnDestroy {
this.store
);
const url = `${location.origin}/exercises/${id}`;
// Could be unavailable in insecure contexts
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (navigator.share) {
navigator.share({ url }).catch((error) => {
if (error.name === 'AbortError') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="modal-header">
<h4 class="modal-title">Koordinaten-Auswahl</h4>
<button type="button" class="btn-close" (click)="close()"></button>
</div>
<div class="modal-body">
<p>Bitte geben Sie die Koordinaten im Format <code>XX.XXXXXX</code> an.</p>

<div class="form-group mb-3">
<label class="form-label">Breitengrad:</label>
<input
class="form-control"
type="text"
[(ngModel)]="latitude"
required
appGeographicCoordinateValidator
#latInput="ngModel"
/>
</div>

<div class="form-group mb-3">
<label class="form-label">Längengrad:</label>
<input
class="form-control"
type="text"
[(ngModel)]="longitude"
required
appGeographicCoordinateValidator
#lonInput="ngModel"
/>
</div>

<button
(click)="goToCoordinates()"
class="btn btn-primary me-1"
type="button"
[disabled]="latInput.invalid || lonInput.invalid"
>
Übernehmen
</button>

<button (click)="close()" class="btn btn-secondary" type="button">
Abbrechen
</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { toLonLat } from 'ol/proj';
import { OlMapManager } from '../../exercise-map/utility/ol-map-manager';

@Component({
selector: 'app-coordinate-picker-modal',
templateUrl: './coordinate-picker-modal.component.html',
styleUrls: ['./coordinate-picker-modal.component.scss'],
})
export class CoordinatePickerModalComponent implements OnInit {
@Input()
public olMapManager!: OlMapManager;

public latitude = '';
public longitude = '';

constructor(public activeModal: NgbActiveModal) {}

ngOnInit() {
const center = this.olMapManager.getCoordinates();

if (!center) return;

const latLonCoordinates = toLonLat(center)
.reverse()
.map((coordinate) => coordinate.toFixed(6));

this.latitude = latLonCoordinates[0]!;
this.longitude = latLonCoordinates[1]!;
}

public goToCoordinates() {
this.olMapManager.tryGoToCoordinates(+this.latitude, +this.longitude);
this.activeModal.close();
}

public close() {
this.activeModal.close();
}
}
Loading

0 comments on commit 0e30049

Please sign in to comment.