Compare commits
5 Commits
f6a824225b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ab91bbf736 | |||
| 57285bf75b | |||
| 883a2825e5 | |||
| 556245a512 | |||
| 51df7e0f01 |
Binary file not shown.
|
Before Width: | Height: | Size: 9.3 KiB |
BIN
assets/static/images/logo.png
Normal file
BIN
assets/static/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
3
compose/dev/.env
Normal file
3
compose/dev/.env
Normal file
@@ -0,0 +1,3 @@
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_DB=confient_dev
|
||||
11
compose/dev/docker-compose.yml
Normal file
11
compose/dev/docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
ports:
|
||||
- 127.0.0.1:5432:5432
|
||||
environment:
|
||||
- POSTGRES_USER=$POSTGRES_USER
|
||||
- POSTGRES_DB=$POSTGRES_DB
|
||||
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||
@@ -1,3 +1,7 @@
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_DB=confient_dev
|
||||
POSTGRES_USER=confient
|
||||
POSTGRES_DB=confient
|
||||
POSTGRES_PASSWORD=password
|
||||
CONFIENT_DATA=/tmp/confient/uploads
|
||||
POSTGRES_DATA=/tmp/confient/pg
|
||||
# gen one with mix phx.gen.secret
|
||||
SECRET_KEY_BASE=aQFwnczmCcy1JOQ/opboa+YSETybKWCELSCjI7i7atIBnLesYJ2dVYVgouIi7SYs
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
version: "3"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
ports:
|
||||
- 127.0.0.1:5432:5432
|
||||
volumes:
|
||||
- $POSTGRES_DATA:/var/lib/postgres
|
||||
environment:
|
||||
- POSTGRES_USER=$POSTGRES_USER
|
||||
- POSTGRES_DB=$POSTGRES_DB
|
||||
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||
|
||||
confient:
|
||||
image: papey/confient:latest
|
||||
ports:
|
||||
- 127.0.0.1:4000:4000
|
||||
volumes:
|
||||
- $CONFIENT_DATA:/srv/confient/uploads
|
||||
environment:
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_USER=$POSTGRES_USER
|
||||
- DATABASE_URL=ecto://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
||||
- SECRET_KEY_BASE=$SECRET_KEY_BASE
|
||||
- CONFIENT_UPLOAD_DIR=/srv/confient/uploads
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
POSTGRES_USER=confient
|
||||
POSTGRES_DB=confient
|
||||
POSTGRES_PASSWORD=password
|
||||
CONFIENT_DATA=/tmp/confient/uploads
|
||||
POSTGRES_DATA=/tmp/confient/pg
|
||||
# gen one with mix phx.gen.secret
|
||||
SECRET_KEY_BASE=aQFwnczmCcy1JOQ/opboa+YSETybKWCELSCjI7i7atIBnLesYJ2dVYVgouIi7SYs
|
||||
@@ -1,26 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
volumes:
|
||||
- $POSTGRES_DATA:/var/lib/postgres
|
||||
environment:
|
||||
- POSTGRES_USER=$POSTGRES_USER
|
||||
- POSTGRES_DB=$POSTGRES_DB
|
||||
- POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||
|
||||
confient:
|
||||
image: papey/confient:latest
|
||||
ports:
|
||||
- 127.0.0.1:4000:4000
|
||||
volumes:
|
||||
- $CONFIENT_DATA:/srv/confient/uploads
|
||||
environment:
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_USER=$POSTGRES_USER
|
||||
- DATABASE_URL=ecto://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
|
||||
- SECRET_KEY_BASE=$SECRET_KEY_BASE
|
||||
- CONFIENT_UPLOAD_DIR=/srv/confient/uploads
|
||||
depends_on:
|
||||
- postgres
|
||||
@@ -31,7 +31,7 @@ config :confient, ConfientWeb.Endpoint,
|
||||
secret_key_base: secret_key_base
|
||||
|
||||
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"),
|
||||
domain: System.get_env("CONFIENT_DOMAIN", "http://localhost:4000")
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ defmodule ConfientWeb.AssignmentController do
|
||||
conn |> put_flash(:error, "Devoir inexistant") |> redirect(to: "/")
|
||||
|
||||
assignment ->
|
||||
base = Application.get_env(:confiant, :base_upload_dir, "/tmp/confient/uploads")
|
||||
base = Application.get_env(:confient, :upload_dir)
|
||||
|
||||
files =
|
||||
Enum.map(assignment.students_works, fn v -> v.path end)
|
||||
|
||||
@@ -20,7 +20,7 @@ defmodule ConfientWeb.DepositController do
|
||||
{:ok, 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{}, %{})
|
||||
|
||||
student =
|
||||
|
||||
@@ -19,7 +19,7 @@ defmodule ConfientWeb.Router do
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/uploads/",
|
||||
from: Application.get_env(:confiant, :base_upload_dir, "/tmp/confient/uploads")
|
||||
from: Application.get_env(:confient, :upload_dir, "/srv/confient/uploads")
|
||||
end
|
||||
|
||||
scope "/", ConfientWeb do
|
||||
|
||||
@@ -7,7 +7,10 @@ defmodule Confient.Deposit do
|
||||
|
||||
def verify_date(due) do
|
||||
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
|
||||
|
||||
def verify_file(file) do
|
||||
|
||||
Reference in New Issue
Block a user