add patch_number and queue_id to dim_match
ci / docker (push) Failing after 3m56s

This commit is contained in:
2024-06-22 20:00:02 +02:00
parent 56ba989ad8
commit 078682fd48
8 changed files with 47 additions and 7 deletions
@@ -1,11 +1,17 @@
defmodule LolAnalytics.Dimensions.Match.MatchRepo do
alias LolAnalytics.Dimensions.Patch.PatchRepo
alias LolAnalytics.Dimensions.Match.MatchSchema
alias LoLAnalytics.Repo
import Ecto.Query
@spec get_or_create(String.t()) :: %MatchSchema{}
def get_or_create(match_id) do
@spec get_or_create(%{
:match_id => String.t(),
:queue_id => integer(),
:patch_number => String.t()
}) :: %MatchSchema{}
def get_or_create(%{match_id: match_id, queue_id: queue_id, patch_number: patch_number}) do
_patch = PatchRepo.get_or_create(patch_number)
query = from m in MatchSchema, where: m.match_id == ^match_id
match = Repo.one(query)
@@ -13,6 +19,9 @@ defmodule LolAnalytics.Dimensions.Match.MatchRepo do
nil ->
%MatchSchema{}
|> MatchSchema.changeset(%{
match_id: match_id,
patch_number: patch_number,
queue_id: queue_id,
fact_champion_played_game_status: 0,
fact_champion_picked_item_status: 0,
fact_champion_picked_summoner_spell_status: 0
@@ -4,6 +4,8 @@ defmodule LolAnalytics.Dimensions.Match.MatchSchema do
@casting_attrs [
:match_id,
:queue_id,
:patch_number,
:fact_champion_picked_item_status,
:fact_champion_picked_summoner_spell_status,
:fact_champion_played_game_status
@@ -11,6 +13,8 @@ defmodule LolAnalytics.Dimensions.Match.MatchSchema do
schema "dim_match" do
field :match_id, :string
field :patch_number, :string
field :queue_id, :integer
field :fact_champion_picked_item_status, :integer
field :fact_champion_picked_summoner_spell_status, :integer
field :fact_champion_played_game_status, :integer
@@ -31,12 +31,18 @@ defmodule LolAnalytics.Facts.ChampionPickedItem.Repo do
:slot_number => integer()
}) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
def insert(attrs) do
match = MatchRepo.get_or_create(attrs.match_id)
_champion = ChampionRepo.get_or_create(attrs.champion_id)
_player = PlayerRepo.get_or_create(attrs.puuid)
_patch = PatchRepo.get_or_create(attrs.patch_number)
_item_id = ItemRepo.get_or_create(attrs.item_id)
match =
MatchRepo.get_or_create(%{
match_id: attrs.match_id,
patch_id: attrs.patch_id,
queue_id: attrs.queue_id
})
prev =
from(f in Schema,
where:
@@ -22,12 +22,18 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.Repo do
:summoner_spell_id => String.t()
}) :: any()
def insert(attrs) do
match = MatchRepo.get_or_create(attrs.match_id)
_champion = ChampionRepo.get_or_create(attrs.champion_id)
_player = PlayerRepo.get_or_create(attrs.puuid)
_spell = SummonerSpellRepo.get_or_create(attrs.summoner_spell_id)
_patch = PatchRepo.get_or_create(attrs.patch_number)
match =
MatchRepo.get_or_create(%{
match_id: attrs.match_id,
patch_id: attrs.patch_id,
queue_id: attrs.queue_id
})
prev =
from(f in Schema,
where:
@@ -10,10 +10,10 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
alias LoLAnalytics.Repo
def insert(attrs) do
match = MatchRepo.get_or_create(attrs.match_id)
_champion = ChampionRepo.get_or_create(attrs.champion_id)
_player = PlayerRepo.get_or_create(attrs.puuid)
_patch = PatchRepo.get_or_create(attrs.patch_number)
match = MatchRepo.get_or_create(attrs.match_id)
prev =
from(f in Schema,