Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
remove typeform
Browse files Browse the repository at this point in the history
  • Loading branch information
augnustin committed Mar 15, 2023
1 parent d63faf1 commit d4409f1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 138 deletions.
46 changes: 4 additions & 42 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,6 @@ config :vae,
rncp: [
url: "https://api.francecompetences.fr/referentiels/v1/fiches",
api_key: System.get_env("RNCP_API_KEY")
],
reminders: [
stock: [
users: [
template_id: 848_006,
form_urls: [
certifiers: [
default: %{
url: System.get_env("TYPEFORM_STOCK_REMINDER")
}
]
]
]
],
monthly: [
users: [
form_urls: [
certifiers: [
asp: %{
ids: [1, 3],
url: System.get_env("TYPEFORM_MONTH_BACK_ASP")
},
educ_nat: %{
ids: [2],
url: System.get_env("TYPEFORM_MONTH_BACK_EDUC_NAT")
},
labour_ministry: %{
ids: [4],
url: System.get_env("TYPEFORM_MONTH_BACK_MINISTRY")
},
other: %{
ids: [],
url: System.get_env("TYPEFORM_MONTH_BACK_OTHER")
}
]
]
]
]
]

config :vae, VaeWeb.Endpoint,
Expand Down Expand Up @@ -115,10 +77,10 @@ config :vae, Vae.Scheduler,
schedule: "0 5 * * *", # 5AM every day
task: {Vae.UserApplications.FollowUp, :send_unsubmitted_raise_email, []}
],
get_admissibility_updates: [
schedule: "30 5 * * *", # 5.30AM every day
task: {Vae.UserApplications.FollowUp, :send_admissibility_update_email, []}
],
# get_admissibility_updates: [
# schedule: "30 5 * * *", # 5.30AM every day
# task: {Vae.UserApplications.FollowUp, :send_admissibility_update_email, []}
# ],
send_delegate_recap: [
schedule: "45 5 1,15 * *", # 5.45AM first and 15th of month
task: {Vae.UserApplications.FollowUp, :send_delegate_recap_email, []}
Expand Down
8 changes: 6 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ services:
command: yarn setup
depends_on:
- nginx
environment:
- NODE_OPTIONS=--openssl-legacy-provider
env_file:
- ./.env
healthcheck:
Expand All @@ -45,7 +47,7 @@ services:
timeout: 3s
retries: 3
start_period: 1m
image: node:16.17.0
image: node:18.15.0
volumes:
- ../avril-livret1:/app
- ./scripts/utils/healthcheck_retry.sh:/healthcheck_retry.sh
Expand All @@ -54,6 +56,8 @@ services:
command: yarn setup
depends_on:
- nginx
environment:
- NODE_OPTIONS=--openssl-legacy-provider
env_file:
- ./.env
healthcheck:
Expand All @@ -62,7 +66,7 @@ services:
timeout: 3s
retries: 3
start_period: 1m
image: node:16.17.0
image: node:18.15.0
volumes:
- ../avril-profil:/app
- ./scripts/utils/healthcheck_retry.sh:/healthcheck_retry.sh
Expand Down
42 changes: 0 additions & 42 deletions lib/vae/user_applications/config.ex

This file was deleted.

33 changes: 0 additions & 33 deletions lib/vae/user_applications/polls.ex

This file was deleted.

36 changes: 17 additions & 19 deletions lib/vae_web/controllers/user_application_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule VaeWeb.UserApplicationController do
require Logger
use VaeWeb, :controller

alias Vae.{UserApplications.Polls, Certification, Delegate, Identity, User, UserApplication, Repo}
alias Vae.{Certification, Delegate, Identity, User, UserApplication, Repo}
alias Vae.Booklet.{Cerfa, Education, CurrentSituation}
plug VaeWeb.Plugs.ApplicationAccess,
[verify_with_hash: :delegate_access_hash] when action in [:show, :cerfa]
Expand Down Expand Up @@ -100,34 +100,32 @@ defmodule VaeWeb.UserApplicationController do
end

def admissible(conn, %{"id" => id}) do
Repo.get(UserApplication, id)
|> case do
nil ->
redirect(conn, to: Routes.root_path(conn, :index))

application ->
UserApplication.admissible_now(application)

conn
|> put_flash(:success, "Merci pour votre réponse")
|> redirect(to: Routes.root_path(conn, :index))
end
user_application_admissibility_status(conn, true, id)
end

def inadmissible(conn, %{"id" => id}) do
user_application_admissibility_status(conn, false, id)
end

defp user_application_admissibility_status(conn, is_admissible, id) do
Repo.get(UserApplication, id)
|> Repo.preload(delegate: :certifiers)
|> case do
nil ->
redirect(conn, to: Routes.root_path(conn, :index))
conn
|> Phoenix.Controller.put_flash(:warning, "La candidature n'a pas été trouvée")
|> Phoenix.Controller.redirect(conn, to: Routes.root_path(conn, :index))

application ->
UserApplication.inadmissible_now(application)

url_form = Polls.define_form_url_from_application(application)
if is_admissible do
UserApplication.admissible_now(application)
else
UserApplication.inadmissible_now(application)
end

conn
|> redirect(external: url_form || Routes.root_path(conn, :index))
|> Phoenix.Controller.put_flash(:success, "Merci pour votre réponse")
|> Phoenix.Controller.redirect(to: Routes.root_path(conn, :index))
end

end
end

0 comments on commit d4409f1

Please sign in to comment.