Compare commits

..

2 Commits

Author SHA1 Message Date
ab91bbf736 Fix: date handling
All checks were successful
continuous-integration/drone/push Build is passing
2020-12-15 18:15:24 +01:00
57285bf75b Fix: handle no students in class in deposit
All checks were successful
continuous-integration/drone/push Build is passing
2020-12-15 17:56:08 +01:00
2 changed files with 5 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ defmodule ConfientWeb.DepositController do
{:ok, class} -> {:ok, class} ->
next_assignments = Confient.Works.get_next_assignments(class) next_assignments = Confient.Works.get_next_assignments(class)
if length(next_assignments) > 0 && length(class.students) do if length(next_assignments) > 0 && length(class.students) > 0 do
changeset = Confient.Student.Work.changeset(%Confient.Student.Work{}, %{}) changeset = Confient.Student.Work.changeset(%Confient.Student.Work{}, %{})
student = student =

View File

@@ -7,7 +7,10 @@ defmodule Confient.Deposit do
def verify_date(due) do def verify_date(due) do
date = DateTime.now!(Application.fetch_env!(:confient, :timezone)) |> DateTime.to_date() date = DateTime.now!(Application.fetch_env!(:confient, :timezone)) |> DateTime.to_date()
if Timex.before?(date, due), do: :ok, else: {:error, :date_too_late}
if Timex.before?(date, due) || Timex.equal?(Timex.to_date(date), due),
do: :ok,
else: {:error, :date_too_late}
end end
def verify_file(file) do def verify_file(file) do