diff --git a/apps/lol_analytics/lib/lol_analytics/match/match_repo.ex b/apps/lol_analytics/lib/lol_analytics/match/match_repo.ex index 8303210..d89f1c9 100644 --- a/apps/lol_analytics/lib/lol_analytics/match/match_repo.ex +++ b/apps/lol_analytics/lib/lol_analytics/match/match_repo.ex @@ -8,6 +8,11 @@ defmodule LolAnalytics.Match.MatchRepo do LoLAnalytics.Repo.all(query) end + def number_of_matches do + query = from m in MatchSchema, select: count(m.match_id) + LoLAnalytics.Repo.one(query) + end + @spec get_match(String.t()) :: %LolAnalytics.Match.MatchSchema{} def get_match(match_id) do query = from m in MatchSchema, where: m.match_id == ^match_id diff --git a/apps/lol_analytics/lib/lol_analytics/player/player_repo.ex b/apps/lol_analytics/lib/lol_analytics/player/player_repo.ex index 6fec828..a6957a4 100644 --- a/apps/lol_analytics/lib/lol_analytics/player/player_repo.ex +++ b/apps/lol_analytics/lib/lol_analytics/player/player_repo.ex @@ -4,10 +4,15 @@ defmodule LolAnalytics.Player.PlayerRepo do import Ecto.Query def list_players do - query = from(p in PlayerSchema) + query = from p in PlayerSchema, order_by: [desc: p.id] LoLAnalytics.Repo.all(query) end + def number_of_players do + query = from p in PlayerSchema, select: count(p.id) + LoLAnalytics.Repo.one(query) + end + def get_player(puuid) do query = from p in PlayerSchema, where: p.puuid == ^puuid LoLAnalytics.Repo.one(query)