From 638f25c679a89cc32f3597b6d40befae512f346d Mon Sep 17 00:00:00 2001 From: lsagona Date: Wed, 18 Nov 2020 09:46:55 +0100 Subject: [PATCH] determine vessel date of first appearance --- src/app/model/vessels.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/model/vessels.ts b/src/app/model/vessels.ts index 282f727..af0f4f5 100644 --- a/src/app/model/vessels.ts +++ b/src/app/model/vessels.ts @@ -3,6 +3,7 @@ import {Message} from './message'; export class Vessels { vessels: Map; + firstAppearance: number; constructor() { this.vessels = new Map(); @@ -12,8 +13,15 @@ export class Vessels { if (!this.vessels.get(Number(message.mmsi))) { this.vessels.set(Number(message.mmsi), new Vessel(new Array())); } - + this.determineFirstAppearance(message); this.vessels.get(Number(message.mmsi)).addMessage(message); } + determineFirstAppearance(message: Message): void { + const timeInS = Date.parse(message.time) / 1000; + if (this.firstAppearance > timeInS) { + this.firstAppearance = timeInS; + } + } + } -- 1.7.10.4