From 3f2a88fcfac47f2ce5069a68e512c86010efc3a7 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 1 Dec 2023 09:56:47 +0100 Subject: [PATCH] fix: fix creating participant stats Map.update/4 does not pass initial value to callback function, so increasing for a new role would set 0 instead of 1 Signed-off-by: Thomas Citharel --- lib/mobilizon/events/events.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 77f69fbed..8796ae442 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -1105,7 +1105,7 @@ defmodule Mobilizon.Events do defp increase_participant_stats(participant_stats, nil), do: participant_stats defp increase_participant_stats(participant_stats, role), - do: Map.update(participant_stats, role, 0, &(&1 + 1)) + do: Map.update(participant_stats, role, 1, &(&1 + 1)) defp decrease_participant_stats(participant_stats, nil), do: participant_stats