Compare commits

...

6 Commits

Author SHA1 Message Date
d07e604cbe fix
Some checks are pending
ci / docker (push) Waiting to run
2024-06-14 03:10:38 +02:00
75ec6a49e9 directly save ranked to ranked bucket 2024-06-14 03:01:06 +02:00
c3de834f57 update tooltip 2024-06-14 02:57:55 +02:00
a5cb6dc299 display boots section in champion detail 2024-06-14 02:56:34 +02:00
56af93b14e pass team_position to get_win_rates_by_patch 2024-06-14 02:54:22 +02:00
45f72cb836 remove inspect 2024-06-14 02:54:03 +02:00
8 changed files with 53 additions and 13 deletions

View File

@ -58,9 +58,10 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
Repo.all(query)
end
def get_win_rates_by_patch(champion_id) do
def get_win_rates_by_patch(champion_id, team_position) do
query =
from m in Schema,
where: m.team_position == ^team_position,
join: c in ChampionSchema,
on: c.champion_id == m.champion_id,
select: %{
@ -80,8 +81,7 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
total_games: count("*")
},
where: c.champion_id == ^champion_id,
group_by: [m.champion_id, c.image, c.name, m.team_position, m.patch_number],
having: count("*") > 100
group_by: [m.champion_id, c.image, c.name, m.team_position, m.patch_number]
Repo.all(query)
end

View File

@ -6,7 +6,6 @@ defmodule LolAnalytics.Facts.FactsRunner do
|> peach(fn %{key: path} ->
get_facts()
|> Enum.each(fn fact_runner ->
IO.inspect(path)
apply(fact_runner, ["http://192.168.1.55:9000/ranked/#{path}"])
end)
end)

View File

@ -12,5 +12,7 @@
.has-tooltip:hover .tooltip {
visibility: visible;
z-index: 100;
background-color:lightsteelblue;
border: 1px solid #333;
background-color: whitesmoke;
border-radius: 12px;
}

View File

@ -12,7 +12,9 @@ defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells do
<p><%= spell.win_rate %>%</p>
<p><%= spell.wins %>/<%= spell.total_games %></p>
</div>
<div class="tooltip -my-8 px-4 py-2 rounded-xl"><%= spell.name %></div>
<div class="tooltip -my-8 px-4 py-2 rounded-xl">
<p><%= spell.name %></p>
</div>
</div>
<% end %>
</div>

View File

@ -21,7 +21,7 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|> assign(:summoner_spells, %{
summoner_spells: load_summoner_spells(id, team_position) |> ShowMapper.map_spells()
})
|> assign(:items, load_items(id, team_position) |> ShowMapper.map_items())}
|> load_items(id, team_position)}
end
defp load_summoner_spells(champion_id, team_position) do
@ -31,11 +31,19 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
)
end
defp load_items(champion_id, team_position) do
defp load_items(socket, champion_id, team_position) do
items =
LolAnalytics.Facts.ChampionPickedItem.Repo.get_champion_picked_items(
champion_id,
team_position
)
all_items_mapped = items |> ShowMapper.map_items() |> Enum.take(30)
boots = items |> ShowMapper.extract_boots()
socket
|> assign(:items, all_items_mapped)
|> assign(:boots, boots)
end
defp load_champion_info(champion_id) do

View File

@ -17,6 +17,16 @@
<h2 class="text-2xl">Items</h2>
<h2 class="text-xl">Boots</h2>
<div class="my-2" />
<.items items={@boots} />
<div class="my-4" />
<h2 class="text-xl">Popular items</h2>
<div class="my-2" />
<.items items={@items} />

View File

@ -47,4 +47,14 @@ defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.ShowMapper do
wins: item.wins
}
end
def extract_boots(items) do
items
|> Enum.filter(fn item ->
tags = item.metadata["tags"]
tags |> Enum.any?(&String.equivalent?(&1, "Boots"))
end)
|> Enum.map(&map_item/1)
|> Enum.sort(&(&1.total_games > &2.total_games))
end
end

View File

@ -44,7 +44,16 @@ defmodule Scrapper.Processor.MatchProcessor do
def process_resp({:ok, raw_match}, match_id) do
decoded_match = Poison.decode!(raw_match, as: %LoLAPI.Model.MatchResponse{})
match_url = Storage.MatchStorage.S3MatchStorage.store_match(match_id, raw_match, "matches")
match_url =
case decoded_match.info.queueId do
420 ->
Storage.MatchStorage.S3MatchStorage.store_match(match_id, raw_match, "ranked", decoded_match.info.gameVersion)
queue_id ->
Storage.MatchStorage.S3MatchStorage.store_match(match_id, raw_match, queue_id)
end
match = LolAnalytics.Match.MatchRepo.get_match(match_id)
case match do