From 16ab6ac69de5f8e2cf0d0291b2f27a28c1d2b748 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 5 Oct 2023 15:20:02 +0200 Subject: [PATCH] Correct count: only count every element once --- src/Postbuilder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Postbuilder.ts b/src/Postbuilder.ts index 722d600..34374db 100644 --- a/src/Postbuilder.ts +++ b/src/Postbuilder.ts @@ -278,7 +278,8 @@ export class Postbuilder { const report = this._config.report const overpass = new Overpass(report) const data = await overpass.query() - const total = data.elements.length + const ids = data.elements.map(e => e.type+"/"+e.id) + const total = new Set(ids).size const date = data.osm3s.timestamp_osm_base.substring(0, 10) lastPostId = (await this._poster.writeMessage( report.post.replace(/{total}/g, "" + total).replace(/{date}/g, date),