Add match url
This commit is contained in:
parent
dafadcbddd
commit
080b18c6be
@ -5,13 +5,14 @@ defmodule LolAnalytics.Match.MatchSchema do
|
|||||||
schema "match" do
|
schema "match" do
|
||||||
field :match_id, :string
|
field :match_id, :string
|
||||||
field :processed, :boolean, default: false
|
field :processed, :boolean, default: false
|
||||||
|
field :match_url, :string
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(%__MODULE__{} = match, params \\ %{}) do
|
def changeset(%__MODULE__{} = match, params \\ %{}) do
|
||||||
match
|
match
|
||||||
|> cast(params, [:match_id, :processed])
|
|> cast(params, [:match_id, :processed, :match_url])
|
||||||
|> validate_required([:match_id, :processed])
|
|> validate_required([:match_id, :processed])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
defmodule LoLAnalytics.Repo.Migrations.MatchUrl do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table("match") do
|
||||||
|
add :match_url, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -44,7 +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: %Scrapper.Api.Model.MatchResponse{})
|
decoded_match = Poison.decode!(raw_match, as: %Scrapper.Api.Model.MatchResponse{})
|
||||||
Scrapper.Storage.S3MatchStorage.store_match(match_id, raw_match)
|
match_url = Scrapper.Storage.S3MatchStorage.store_match(match_id, raw_match)
|
||||||
match = LolAnalytics.Match.MatchRepo.get_match(match_id)
|
match = LolAnalytics.Match.MatchRepo.get_match(match_id)
|
||||||
|
|
||||||
case match do
|
case match do
|
||||||
@ -52,7 +52,10 @@ defmodule Scrapper.Processor.MatchProcessor do
|
|||||||
LolAnalytics.Match.MatchRepo.insert_match(match_id)
|
LolAnalytics.Match.MatchRepo.insert_match(match_id)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
LolAnalytics.Match.MatchRepo.update_match(match, %{:processed => true})
|
LolAnalytics.Match.MatchRepo.update_match(match, %{
|
||||||
|
:processed => true,
|
||||||
|
:match_url => match_url
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
decoded_match.metadata.participants
|
decoded_match.metadata.participants
|
||||||
|
Loading…
x
Reference in New Issue
Block a user