Add match url
This commit is contained in:
parent
dafadcbddd
commit
080b18c6be
@ -5,13 +5,14 @@ defmodule LolAnalytics.Match.MatchSchema do
|
||||
schema "match" do
|
||||
field :match_id, :string
|
||||
field :processed, :boolean, default: false
|
||||
field :match_url, :string
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
def changeset(%__MODULE__{} = match, params \\ %{}) do
|
||||
match
|
||||
|> cast(params, [:match_id, :processed])
|
||||
|> cast(params, [:match_id, :processed, :match_url])
|
||||
|> validate_required([:match_id, :processed])
|
||||
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
|
||||
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)
|
||||
|
||||
case match do
|
||||
@ -52,7 +52,10 @@ defmodule Scrapper.Processor.MatchProcessor do
|
||||
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
|
||||
|
||||
decoded_match.metadata.participants
|
||||
|
Loading…
x
Reference in New Issue
Block a user