Closed pdgonzalez872 closed 2 months ago
This call here: https://github.com/algora-io/tv/blob/main/lib/algora/ads.ex#L165 cries when we use rem/2 and the list is empty.
rem/2
It doesn't allow /ads to load.
/ads
Logs:
15:26:44.299 [error] #PID<0.1056.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.1055.0>, stream id 1) terminated Server: localhost:4000 (http) Request: GET /ads ** (exit) an exception was raised: ** (ArithmeticError) bad argument in arithmetic expression (erts 14.1.1) :erlang.rem(958888, 0) (algora 0.1.0) lib/algora/ads.ex:167: Algora.Ads.get_current_index/1 (algora 0.1.0) lib/algora/ads.ex:171: Algora.Ads.rotate_ads/2 (algora 0.1.0) lib/algora_web/live/ad_live/index.ex:17: AlgoraWeb.AdLive.Index.mount/3 (phoenix_live_view 0.20.12) lib/phoenix_live_view/utils.ex:354: anonymous fn/6 in Phoenix.LiveView.Utils.maybe_call_live_view_mount!/5 (telemetry 1.2.1) /home/paulo/dev/oss/tv/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3 (phoenix_live_view 0.20.12) lib/phoenix_live_view/static.ex:281: Phoenix.LiveView.Static.call_mount_and_handle_params!/5 (phoenix_live_view 0.20.12) lib/phoenix_live_view/static.ex:116: Phoenix.LiveView.Static.render/3 (phoenix_live_view 0.20.12) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3 (phoenix 1.7.11) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5 (algora 0.1.0) lib/algora_web/endpoint.ex:1: AlgoraWeb.Endpoint.plug_builder_call/2 (algora 0.1.0) deps/plug/lib/plug/debugger.ex:136: AlgoraWeb.Endpoint."call (overridable 3)"/2 (algora 0.1.0) lib/algora_web/endpoint.ex:1: AlgoraWeb.Endpoint.call/2 (phoenix 1.7.11) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4 (plug_cowboy 2.7.0) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2 (cowboy 2.10.0) /home/paulo/dev/oss/tv/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2 (cowboy 2.10.0) /home/paulo/dev/oss/tv/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3 (cowboy 2.10.0) /home/paulo/dev/oss/tv/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3 (stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
This call here: https://github.com/algora-io/tv/blob/main/lib/algora/ads.ex#L165 cries when we use
rem/2
and the list is empty.It doesn't allow
/ads
to load.Logs: