Compare commits
6 Commits
656edf30a7
...
d07e604cbe
Author | SHA1 | Date | |
---|---|---|---|
d07e604cbe | |||
75ec6a49e9 | |||
c3de834f57 | |||
a5cb6dc299 | |||
56af93b14e | |||
45f72cb836 |
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
@ -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>
|
||||
|
@ -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
|
||||
LolAnalytics.Facts.ChampionPickedItem.Repo.get_champion_picked_items(
|
||||
champion_id,
|
||||
team_position
|
||||
)
|
||||
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
|
||||
|
@ -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} />
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user