Commit b8c236a0 authored by Peter van der meulen's avatar Peter van der meulen

Accepted case condition

parent 760bca25
......@@ -175,10 +175,9 @@ defmodule SnugglesApp.Accounts do
"""
def handle_create_corp(object) do
user = Repo.get_by(User, discord_id: Integer.to_string(object["author_id"]))
if user do
corp = Repo.get_by(Corporation, eve_corp_id: user.eve_corp_id)
else
corp = Repo.get_by(Corporation, discord_guild_id: Integer.to_string(object["guild_id"]))
corp = case user do
nil -> Repo.get_by(Corporation, discord_guild_id: Integer.to_string(object["guild_id"]))
_ -> Repo.get_by(Corporation, eve_corp_id: user.eve_corp_id)
end
cond do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment