Compare commits
No commits in common. "d07e604cbeaf04805c7c58d2826bfbef9a217a78" and "656edf30a7fb93ebd825f77e9d5483206c3ea1dd" have entirely different histories.
d07e604cbe
...
656edf30a7
@ -58,10 +58,9 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
|
|||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_win_rates_by_patch(champion_id, team_position) do
|
def get_win_rates_by_patch(champion_id) do
|
||||||
query =
|
query =
|
||||||
from m in Schema,
|
from m in Schema,
|
||||||
where: m.team_position == ^team_position,
|
|
||||||
join: c in ChampionSchema,
|
join: c in ChampionSchema,
|
||||||
on: c.champion_id == m.champion_id,
|
on: c.champion_id == m.champion_id,
|
||||||
select: %{
|
select: %{
|
||||||
@ -81,7 +80,8 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
|
|||||||
total_games: count("*")
|
total_games: count("*")
|
||||||
},
|
},
|
||||||
where: c.champion_id == ^champion_id,
|
where: c.champion_id == ^champion_id,
|
||||||
group_by: [m.champion_id, c.image, c.name, m.team_position, m.patch_number]
|
group_by: [m.champion_id, c.image, c.name, m.team_position, m.patch_number],
|
||||||
|
having: count("*") > 100
|
||||||
|
|
||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,6 +6,7 @@ defmodule LolAnalytics.Facts.FactsRunner do
|
|||||||
|> peach(fn %{key: path} ->
|
|> peach(fn %{key: path} ->
|
||||||
get_facts()
|
get_facts()
|
||||||
|> Enum.each(fn fact_runner ->
|
|> Enum.each(fn fact_runner ->
|
||||||
|
IO.inspect(path)
|
||||||
apply(fact_runner, ["http://192.168.1.55:9000/ranked/#{path}"])
|
apply(fact_runner, ["http://192.168.1.55:9000/ranked/#{path}"])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@ -12,7 +12,5 @@
|
|||||||
.has-tooltip:hover .tooltip {
|
.has-tooltip:hover .tooltip {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border: 1px solid #333;
|
background-color:lightsteelblue;
|
||||||
background-color: whitesmoke;
|
|
||||||
border-radius: 12px;
|
|
||||||
}
|
}
|
||||||
@ -12,9 +12,7 @@ defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells do
|
|||||||
<p><%= spell.win_rate %>%</p>
|
<p><%= spell.win_rate %>%</p>
|
||||||
<p><%= spell.wins %>/<%= spell.total_games %></p>
|
<p><%= spell.wins %>/<%= spell.total_games %></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="tooltip -my-8 px-4 py-2 rounded-xl">
|
<div class="tooltip -my-8 px-4 py-2 rounded-xl"><%= spell.name %></div>
|
||||||
<p><%= spell.name %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,7 +21,7 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|
|||||||
|> assign(:summoner_spells, %{
|
|> assign(:summoner_spells, %{
|
||||||
summoner_spells: load_summoner_spells(id, team_position) |> ShowMapper.map_spells()
|
summoner_spells: load_summoner_spells(id, team_position) |> ShowMapper.map_spells()
|
||||||
})
|
})
|
||||||
|> load_items(id, team_position)}
|
|> assign(:items, load_items(id, team_position) |> ShowMapper.map_items())}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp load_summoner_spells(champion_id, team_position) do
|
defp load_summoner_spells(champion_id, team_position) do
|
||||||
@ -31,19 +31,11 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp load_items(socket, champion_id, team_position) do
|
defp load_items(champion_id, team_position) do
|
||||||
items =
|
|
||||||
LolAnalytics.Facts.ChampionPickedItem.Repo.get_champion_picked_items(
|
LolAnalytics.Facts.ChampionPickedItem.Repo.get_champion_picked_items(
|
||||||
champion_id,
|
champion_id,
|
||||||
team_position
|
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
|
end
|
||||||
|
|
||||||
defp load_champion_info(champion_id) do
|
defp load_champion_info(champion_id) do
|
||||||
|
|||||||
@ -17,16 +17,6 @@
|
|||||||
|
|
||||||
<h2 class="text-2xl">Items</h2>
|
<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" />
|
<div class="my-2" />
|
||||||
|
|
||||||
<.items items={@items} />
|
<.items items={@items} />
|
||||||
@ -47,14 +47,4 @@ defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.ShowMapper do
|
|||||||
wins: item.wins
|
wins: item.wins
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@ -44,16 +44,7 @@ defmodule Scrapper.Processor.MatchProcessor do
|
|||||||
|
|
||||||
def process_resp({:ok, raw_match}, match_id) do
|
def process_resp({:ok, raw_match}, match_id) do
|
||||||
decoded_match = Poison.decode!(raw_match, as: %LoLAPI.Model.MatchResponse{})
|
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)
|
match = LolAnalytics.Match.MatchRepo.get_match(match_id)
|
||||||
|
|
||||||
case match do
|
case match do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user