Skip to content

Commit

Permalink
fix: own leadTime per station AB#27137
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Mar 20, 2024
1 parent 13922e3 commit c5170e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,6 @@ export class AdminLevelComponent implements OnInit, OnDestroy {
}

public disableNationalView(): boolean {
return this.eventState.events.length === 1;
return this.eventState?.events?.length === 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { EapAlertClass, EapAlertClasses } from '../../../models/country.model';
import { Station } from '../../../models/poi.model';
import { LeadTime } from '../../../types/lead-time';
Expand Down Expand Up @@ -28,8 +27,6 @@ export class GlofasStationPopupContentComponent implements OnInit {
value: 0,
};

constructor(private translate: TranslateService) {}

ngOnInit(): void {
if (!this.data) {
return;
Expand Down Expand Up @@ -80,6 +77,6 @@ export class GlofasStationPopupContentComponent implements OnInit {

const [value, unit] = this.data.leadTime.split('-');

return `${value} ${unit}${Number(value) > 1 ? 's' : ''}`;
return `${value} ${unit}${Number(value) === 1 ? '' : 's'}`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export class MapComponent implements AfterViewInit, OnDestroy {
geoJsonPoint.properties as Station,
latlng,
this.countryDisasterSettings,
this.timelineState.activeLeadTime,
this.eventState?.events,
);
}
case IbfLayerName.redCrossBranches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
} from '../models/country.model';
import { IbfLayerName } from '../types/ibf-layer';
import { LeadTime } from '../types/lead-time';
import { EventService } from './event.service';
import { EventService, EventSummary } from './event.service';

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -119,10 +119,13 @@ export class PointMarkerService {
markerProperties: Station,
markerLatLng: LatLng,
countryDisasterSettings: CountryDisasterSettings,
activeLeadTime: LeadTime,
events: EventSummary[],
): Marker {
const markerTitle = markerProperties.stationName;
const activeLeadTime = events.find(
(e) => e.eventName === markerProperties.stationCode, // TODO: this counds on eventName being equal to stationCode!
)?.firstLeadTime as LeadTime;

const markerTitle = markerProperties.stationName;
const markerIcon: IconOptions = {
...LEAFLET_MARKER_ICON_OPTIONS_BASE,
iconUrl: `assets/markers/glofas-station-${
Expand Down

0 comments on commit c5170e0

Please sign in to comment.