[extra-01] adjust training query to filter by period

This commit is contained in:
Joao P Dubas 2021-06-28 00:26:04 +00:00
parent a69b771847
commit 1597d34a2d

View File

@ -25,7 +25,7 @@ defmodule Wabanex.Users.Get do
query =
from(t in Training,
where: ^today >= t.start_date and ^today <= t.end_date
where: fragment("?::date <@ ?", ^today, t.period)
)
Repo.preload(user, trainings: {first(query, :inserted_at), :exercises})