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:
parent
9e6b232a78
commit
3f2a88fcfa
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue