pass team_position to get_win_rates_by_patch
This commit is contained in:
parent
45f72cb836
commit
56af93b14e
@ -58,9 +58,10 @@ defmodule LolAnalytics.Facts.ChampionPlayedGame.Repo do
|
|||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_win_rates_by_patch(champion_id) do
|
def get_win_rates_by_patch(champion_id, team_position) 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: %{
|
||||||
@ -80,8 +81,7 @@ 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user