Skip to content

Commit

Permalink
WFNEWS-2389 : Stage of Control counts on dashboard (#2074)
Browse files Browse the repository at this point in the history
* Shorten TTL of statistics cache

* Add FoN to Active Wildfire counts

* Change to use DeclaredOutDate

* Add previous year stats to Wildfire Cause widgets

* Remove previousYearOut totals

* Fix totals

* Fix stage of control counts
  • Loading branch information
sukhpalp authored Aug 7, 2024
1 parent acc4a5f commit b8be2bb
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ActiveFiresWidget implements AfterViewInit {

public chartSize = 180;

constructor(private publishedIncidentService: PublishedIncidentService) {}
constructor(private publishedIncidentService: PublishedIncidentService) { }

ngAfterViewInit(): void {
this.queryData();
Expand All @@ -40,7 +40,7 @@ export class ActiveFiresWidget implements AfterViewInit {
const fireCentre =
this.selectedFireCentreCode && this.selectedFireCentreCode !== ''
? FireCentres.find((fc) => fc.code === this.selectedFireCentreCode)
.description
.description
: 'BC';

Promise.all([
Expand Down Expand Up @@ -134,35 +134,35 @@ export class ActiveFiresWidget implements AfterViewInit {
this.activeFireOfNote = currentYearActiveFoN + previousYearActiveFoN;
this.activeOutOfControl =
(stats.reduce(
(n, { activeOutOfControlFires }) => n + activeOutOfControlFires,
(n, { activeOutOfControlFires, activeOutOfControlFiresOfNote }) => n + activeOutOfControlFires + activeOutOfControlFiresOfNote,
0,
) || 0) +
(previousYearStats.reduce(
(n, { activeOutOfControlFires }) => n + activeOutOfControlFires,
(n, { activeOutOfControlFires, activeOutOfControlFiresOfNote }) => n + activeOutOfControlFires + activeOutOfControlFiresOfNote,
0,
) || 0);
this.activeBeingHeld =
(stats.reduce(
(n, { activeBeingHeldFires }) => n + activeBeingHeldFires,
(n, { activeBeingHeldFires, activeBeingHeldFiresOfNote }) => n + activeBeingHeldFires + activeBeingHeldFiresOfNote,
0,
) || 0) +
(previousYearStats.reduce(
(n, { activeBeingHeldFires }) => n + activeBeingHeldFires,
(n, { activeBeingHeldFires, activeBeingHeldFiresOfNote }) => n + activeBeingHeldFires + activeBeingHeldFiresOfNote,
0,
) || 0);
this.activeUnderControl =
(stats.reduce(
(n, { activeUnderControlFires }) => n + activeUnderControlFires,
(n, { activeUnderControlFires, activeUnderControlFiresOfNote }) => n + activeUnderControlFires + activeUnderControlFiresOfNote,
0,
) || 0) +
(previousYearStats.reduce(
(n, { activeUnderControlFires }) => n + activeUnderControlFires,
(n, { activeUnderControlFires, activeUnderControlFiresOfNote }) => n + activeUnderControlFires + activeUnderControlFiresOfNote,
0,
) || 0);

this.outOfControlData = [
{ name: 'Out of Control', value: this.activeOutOfControl },
{ name: 'All Fires Minus', value: this.activeFires - this.activeOutOfControl},
{ name: 'All Fires Minus', value: this.activeFires - this.activeOutOfControl },
];
this.beingHeldData = [
{ name: 'Being Held', value: this.activeBeingHeld },
Expand Down

0 comments on commit b8be2bb

Please sign in to comment.