Skip to content

Commit

Permalink
fixing tests and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
hpistudent72 committed May 29, 2022
1 parent 4b398a0 commit b921aff
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"onStartup": ["all-tests"]
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ <h5 class="popover-header">
<td>
<select
[ngModel]="patientStatus$ | async"
(ngModelChange)="
setPretriageCategory($event)
"
(ngModelChange)="setPretriageCategory($event)"
>
<option [value]="'black'">EX</option>
<option [value]="'blue'">SK IV</option>
Expand Down
3 changes: 2 additions & 1 deletion shared/src/models/patient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export class Patient {
static readonly msUntilRealStatus: number = 120_000;

static getVisibleStatus(patient: Patient, pretriageEnabled: boolean) {
return !pretriageEnabled || patient.treatmentTime >= this.msUntilRealStatus
return !pretriageEnabled ||
patient.treatmentTime >= this.msUntilRealStatus
? patient.realStatus
: patient.pretriageStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ function assertCatering(
}

function generatePatient(
visibleStatus: PatientStatus,
pretriageStatus: PatientStatus,
realStatus: PatientStatus,
position?: Position
): Mutable<Patient> {
const patient = generateDummyPatient() as Mutable<Patient>;
patient.visibleStatus = visibleStatus;
patient.pretriageStatus = pretriageStatus;
patient.realStatus = realStatus;
if (position) {
patient.position = { ...position };
Expand Down
13 changes: 9 additions & 4 deletions shared/src/store/action-reducers/utils/calculate-treatments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { groupBy } from 'lodash-es';
import type { Material, Personnel} from '../../../models';
import type { Material, Personnel } from '../../../models';
import { Patient } from '../../../models';
import type { PatientStatus } from '../../../models/utils';
import type { ExerciseState } from '../../../state';
Expand Down Expand Up @@ -30,10 +30,13 @@ function caterFor(
catering: Mutable<Material> | Mutable<Personnel>,
catersFor: Mutable<CatersFor>,
patient: Mutable<Patient>,
pretriageEnabled: boolean,
pretriageEnabled: boolean
) {
// Treat not pretriaged patients as yellow.
const status = Patient.getVisibleStatus(patient, pretriageEnabled) === 'white' ? 'yellow' : Patient.getVisibleStatus(patient, pretriageEnabled);
const status =
Patient.getVisibleStatus(patient, pretriageEnabled) === 'white'
? 'yellow'
: Patient.getVisibleStatus(patient, pretriageEnabled);
if (
(status === 'red' && catering.canCaterFor.red <= catersFor.red) ||
(status === 'yellow' &&
Expand Down Expand Up @@ -150,7 +153,9 @@ function calculateCatering(
> = groupBy(
distances,
({ patient }) =>
Patient.getVisibleStatus(patient, pretriageEnabled) === 'white' ? 'yellow' : Patient.getVisibleStatus(patient, pretriageEnabled) // Treat untriaged patients as yellow
Patient.getVisibleStatus(patient, pretriageEnabled) === 'white'
? 'yellow'
: Patient.getVisibleStatus(patient, pretriageEnabled) // Treat untriaged patients as yellow
);

const redPatients =
Expand Down
4 changes: 2 additions & 2 deletions shared/src/utils/exercise-configuration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCreate } from "../models/utils";
import { getCreate } from '../models/utils';

export class ExerciseConfiguration{
export class ExerciseConfiguration {
public readonly pretriageEnabled: boolean = true;

static readonly create = getCreate(this);
Expand Down

0 comments on commit b921aff

Please sign in to comment.