Extracting the case statement to a function would also mandate that function have 2 parameters: participant and user_id. And since your case statement is only 5 lines long I don’t think the extraction would make the code better in any way.
I think the code is fine. Do always run mix format though, I’d write DateTime.utc_now() and not DateTime.utc_now – always put parentheses even when calling functions without an argument.


















