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 <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-12-01 09:56:47 +01:00
parent 9e6b232a78
commit 3f2a88fcfa
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -1105,7 +1105,7 @@ defmodule Mobilizon.Events do
defp increase_participant_stats(participant_stats, nil), do: participant_stats defp increase_participant_stats(participant_stats, nil), do: participant_stats
defp increase_participant_stats(participant_stats, role), 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 defp decrease_participant_stats(participant_stats, nil), do: participant_stats