Compare commits

..

4 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
883a2825e5 Fix: upload dir
All checks were successful
continuous-integration/drone/push Build is passing
2020-12-13 20:10:54 +01:00
556245a512 Fix: logo
All checks were successful
continuous-integration/drone/push Build is passing
2020-12-12 20:02:52 +01:00
7 changed files with 8 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -31,7 +31,7 @@ config :confient, ConfientWeb.Endpoint,
secret_key_base: secret_key_base secret_key_base: secret_key_base
config :confient, config :confient,
base_upload_dir: System.get_env("CONFIENT_BASE_UPLOAD_DIR", "/srv/confient/uploads"), upload_dir: System.get_env("CONFIENT_UPLOAD_DIR", "/srv/confient/uploads"),
timezone: System.get_env("CONFIENT_TIMEZONE", "Europe/Paris"), timezone: System.get_env("CONFIENT_TIMEZONE", "Europe/Paris"),
domain: System.get_env("CONFIENT_DOMAIN", "http://localhost:4000") domain: System.get_env("CONFIENT_DOMAIN", "http://localhost:4000")

View File

@@ -79,7 +79,7 @@ defmodule ConfientWeb.AssignmentController do
conn |> put_flash(:error, "Devoir inexistant") |> redirect(to: "/") conn |> put_flash(:error, "Devoir inexistant") |> redirect(to: "/")
assignment -> assignment ->
base = Application.get_env(:confiant, :base_upload_dir, "/tmp/confient/uploads") base = Application.get_env(:confient, :upload_dir)
files = files =
Enum.map(assignment.students_works, fn v -> v.path end) Enum.map(assignment.students_works, fn v -> v.path end)

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

@@ -19,7 +19,7 @@ defmodule ConfientWeb.Router do
plug Plug.Static, plug Plug.Static,
at: "/uploads/", at: "/uploads/",
from: Application.get_env(:confiant, :base_upload_dir, "/tmp/confient/uploads") from: Application.get_env(:confient, :upload_dir, "/srv/confient/uploads")
end end
scope "/", ConfientWeb do scope "/", ConfientWeb do

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