scraper updates
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 37s
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 37s
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
defmodule CobblemonUiWeb.DashboardLive do
|
||||
use CobblemonUiWeb, :live_view
|
||||
|
||||
require Logger
|
||||
|
||||
import CobblemonUiWeb.PokemonComponents
|
||||
import CobblemonUiWeb.BattleComponents
|
||||
|
||||
@@ -10,7 +8,6 @@ defmodule CobblemonUiWeb.DashboardLive do
|
||||
def mount(_params, _session, socket) do
|
||||
if connected?(socket) do
|
||||
:timer.send_interval(1000, self(), :tick)
|
||||
unless File.exists?(CobblemonUi.TierListScraper.output_file()), do: send(self(), :scrape_tier_list)
|
||||
end
|
||||
|
||||
players =
|
||||
@@ -26,7 +23,7 @@ defmodule CobblemonUiWeb.DashboardLive do
|
||||
player_data: nil,
|
||||
battle: nil,
|
||||
selected_pokemon: nil,
|
||||
tier_list: CobblemonUi.TierListScraper.load_tier_list(),
|
||||
tier_list: CobblemonUi.TierListScraper.get_tier_list(),
|
||||
view_mode: :party,
|
||||
loading: false,
|
||||
error: nil
|
||||
@@ -102,20 +99,6 @@ defmodule CobblemonUiWeb.DashboardLive do
|
||||
{:noreply, do_refresh(socket)}
|
||||
end
|
||||
|
||||
def handle_info(:scrape_tier_list, socket) do
|
||||
lv = self()
|
||||
Task.start(fn ->
|
||||
case CobblemonUi.TierListScraper.run() do
|
||||
{:ok, _} -> send(lv, :reload_tier_list)
|
||||
{:error, reason} -> Logger.error("[DashboardLive] Tier list scrape failed: #{inspect(reason)}")
|
||||
end
|
||||
end)
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_info(:reload_tier_list, socket) do
|
||||
{:noreply, assign(socket, tier_list: CobblemonUi.TierListScraper.load_tier_list())}
|
||||
end
|
||||
|
||||
defp do_refresh(socket) do
|
||||
players =
|
||||
|
||||
Reference in New Issue
Block a user