This commit is contained in:
parent
5ce7ce0542
commit
6053cfcdac
@ -13,8 +13,8 @@ defmodule LolAnalytics.Analyzer.ChampionAnalyzer do
|
|||||||
@doc """
|
@doc """
|
||||||
iex> LolAnalytics.Analyzer.ChampionAnalyzer.analyze(:url, "http://localhost:9000/ranked/14.9.580.2108/EUW1_6923309745.json")
|
iex> LolAnalytics.Analyzer.ChampionAnalyzer.analyze(:url, "http://localhost:9000/ranked/14.9.580.2108/EUW1_6923309745.json")
|
||||||
"""
|
"""
|
||||||
|
@spec analyze(any(), any()) :: none()
|
||||||
@impl true
|
@impl true
|
||||||
@spec analyze(atom(), String.t()) :: :ok
|
|
||||||
def analyze(:url, path) do
|
def analyze(:url, path) do
|
||||||
data = HTTPoison.get!(path)
|
data = HTTPoison.get!(path)
|
||||||
analyze(:data, data.body)
|
analyze(:data, data.body)
|
||||||
@ -22,7 +22,6 @@ defmodule LolAnalytics.Analyzer.ChampionAnalyzer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@spec analyze(atom(), any()) :: list(LoLAPI.Model.Participant.t())
|
|
||||||
def analyze(:data, data) do
|
def analyze(:data, data) do
|
||||||
decoded_match = Poison.decode!(data, as: %LoLAPI.Model.MatchResponse{})
|
decoded_match = Poison.decode!(data, as: %LoLAPI.Model.MatchResponse{})
|
||||||
participants = decoded_match.info.participants
|
participants = decoded_match.info.participants
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
defmodule LolAnalytics.Facts.ChampionPlayedGame.ChampionPlayedGameRepo do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
defmodule LolAnalytics.Facts.ChampionPlayedGame.ChampionPlayedGameSchema do
|
||||||
|
use Ecto.Schema
|
||||||
|
|
||||||
|
schema "fact_champion_played_game" do
|
||||||
|
field :champion_id, :integer
|
||||||
|
field :match_id, :integer
|
||||||
|
field :is_win, :boolean
|
||||||
|
field :game_length_seconds, :integer
|
||||||
|
field :queue_id, :integer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,51 @@
|
|||||||
|
defmodule LoLAnalytics.Repo.Migrations.AnalyticsTables do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table("dom_champion") do
|
||||||
|
add :champion_id, :integer, primary_key: true
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create table("dom_match") do
|
||||||
|
add :match_id, :integer, primary_key: true
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create index("dom_match", [:match_id], unique: true)
|
||||||
|
|
||||||
|
create table("dom_patch") do
|
||||||
|
add :patch_number, :string, primary_key: true
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create index("dom_patch", [:patch_number], unique: true)
|
||||||
|
|
||||||
|
create table("dom_item") do
|
||||||
|
add :item_id, :integer, primary_key: true
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create index("dom_item", [:item_id], unique: true)
|
||||||
|
|
||||||
|
create table("dom_summoner_spell") do
|
||||||
|
add :spell_id, :integer, primary_key: true
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create index("dom_summoner_spell", [:spell_id], unique: true)
|
||||||
|
|
||||||
|
create table("fact_champion_played_game") do
|
||||||
|
add :champion_id, references("dom_champion", with: [champion_id: :champion_id]),
|
||||||
|
primary_key: true
|
||||||
|
|
||||||
|
add :match_id, references("dom_match", with: [match_id: :match_id])
|
||||||
|
add :is_win, :boolean
|
||||||
|
add :game_length_seconds, :integer
|
||||||
|
add :queue_id, :integer
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create index("fact_champion_played_game", [:id, :champion_id, :queue_id])
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user