fix match processing status
Some checks failed
ci / docker (push) Failing after 4m14s

This commit is contained in:
Álvaro 2024-06-24 13:57:19 +02:00
parent e364b20b1b
commit 8ed22bebf0
8 changed files with 37 additions and 11 deletions

View File

@ -13,6 +13,6 @@ defmodule LolAnalytics.Dimensions.Item.ItemSchema do
def changeset(item = %__MODULE__{}, attrs \\ %{}) do
item
|> cast(attrs, @args)
|> validate_required(@args)
|> validate_required([:item_id])
end
end

View File

@ -26,7 +26,7 @@ defmodule LolAnalytics.Dimensions.Match.MatchRepo do
fact_champion_picked_item_status: 0,
fact_champion_picked_summoner_spell_status: 0
})
|> Repo.insert()
|> Repo.insert!()
match ->
match
@ -54,7 +54,7 @@ defmodule LolAnalytics.Dimensions.Match.MatchRepo do
match
|> MatchSchema.changeset(mapped_attrs)
|> Repo.update()
|> Repo.update!()
end
def list_matches() do

View File

@ -1,4 +1,5 @@
defmodule LolAnalytics.Facts.ChampionPickedItem.FactProcessor do
alias LolAnalytics.Dimensions.Match.MatchRepo
alias LolAnalytics.Facts.ChampionPickedItem.Repo
require Logger
@behaviour LolAnalytics.Facts.FactBehaviour
@ -24,6 +25,13 @@ defmodule LolAnalytics.Facts.ChampionPickedItem.FactProcessor do
participants = decoded_match.info.participants
version = extract_game_version(decoded_match)
match =
MatchRepo.get_or_create(%{
match_id: decoded_match.metadata.matchId,
patch_number: decoded_match.info.gameVersion,
queue_id: decoded_match.info.queueId
})
Logger.info("Processing ChampionPickedItem for match #{decoded_match.metadata.matchId}")
participants
@ -49,6 +57,8 @@ defmodule LolAnalytics.Facts.ChampionPickedItem.FactProcessor do
end)
end
end)
MatchRepo.update(match, %{fact_champion_picked_item_status: :processed})
end
defp extract_game_version(game_data) do

View File

@ -36,7 +36,7 @@ defmodule LolAnalytics.Facts.ChampionPickedItem.Repo do
_patch = PatchRepo.get_or_create(attrs.patch_number)
_item_id = ItemRepo.get_or_create(attrs.item_id)
match =
_match =
MatchRepo.get_or_create(%{
match_id: attrs.match_id,
patch_number: attrs.patch_number,
@ -55,8 +55,6 @@ defmodule LolAnalytics.Facts.ChampionPickedItem.Repo do
Schema.changeset(prev || %Schema{}, attrs)
|> Repo.insert_or_update()
MatchRepo.update(match, %{fact_champion_picked_item: :processed})
end
@spec get_champion_picked_items(String.t(), String.t(), String.t()) :: list()

View File

@ -3,6 +3,7 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.FactProcessor do
require Logger
alias LolAnalytics.Dimensions.Match.MatchRepo
alias LolAnalytics.Facts.ChampionPickedSummonerSpell
@impl true
@ -23,6 +24,13 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.FactProcessor do
participants = decoded_match.info.participants
version = extract_game_version(decoded_match)
match =
MatchRepo.get_or_create(%{
match_id: decoded_match.metadata.matchId,
patch_number: decoded_match.info.gameVersion,
queue_id: decoded_match.info.queueId
})
Logger.info("Processing ChampionPickedSummoner for match #{decoded_match.metadata.matchId}")
participants
@ -56,6 +64,8 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.FactProcessor do
ChampionPickedSummonerSpell.Repo.insert(attrs_spell_2)
end
end)
MatchRepo.update(match, %{fact_champion_picked_summoner_spell_status: :processed})
end
defp extract_game_version(game_data) do

View File

@ -27,7 +27,7 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.Repo do
_spell = SummonerSpellRepo.get_or_create(attrs.summoner_spell_id)
_patch = PatchRepo.get_or_create(attrs.patch_number)
match =
_match =
MatchRepo.get_or_create(%{
match_id: attrs.match_id,
patch_number: attrs.patch_number,
@ -46,8 +46,6 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.Repo do
Schema.changeset(prev || %Schema{}, attrs)
|> Repo.insert_or_update()
MatchRepo.update(match, %{fact_champion_picked_summoner_spell: :processed})
end
@spec get_champion_picked_summoners(String.t(), String.t(), String.t()) :: list()

View File

@ -13,7 +13,8 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
_champion = ChampionRepo.get_or_create(attrs.champion_id)
_player = PlayerRepo.get_or_create(attrs.puuid)
_patch = PatchRepo.get_or_create(attrs.patch_number)
match =
_match =
MatchRepo.get_or_create(%{
match_id: attrs.match_id,
patch_number: attrs.patch_number,
@ -31,7 +32,6 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
changeset = Schema.changeset(prev || %Schema{}, attrs)
Repo.insert_or_update(changeset)
MatchRepo.update(match, %{fact_champion_played_game: :processed})
end
def list_played_matches() do

View File

@ -1,4 +1,5 @@
defmodule LolAnalytics.Facts.ChampionPlayedGame.FactProcessor do
alias LolAnalytics.Dimensions.Match.MatchRepo
require Logger
@behaviour LolAnalytics.Facts.FactBehaviour
@ -21,6 +22,13 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.FactProcessor do
participants = decoded_match.info.participants
version = extract_game_version(decoded_match)
match =
MatchRepo.get_or_create(%{
match_id: decoded_match.metadata.matchId,
patch_number: decoded_match.info.gameVersion,
queue_id: decoded_match.info.queueId
})
Logger.info("Processing ChampionPlayedMatch for #{decoded_match.metadata.matchId}")
participants
@ -40,6 +48,8 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.FactProcessor do
LolAnalytics.Facts.ChampionPlayedGame.Repo.insert(attrs)
end
end)
MatchRepo.update(match, %{fact_champion_played_game_status: :processed})
end
defp extract_game_version(game_data) do