mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-12 21:05:19 +02:00
8382900b9e
* feat: add reset progress action for a candidate's quiz attempt Admins previously had no way to let a candidate retake a quiz once started. Adds a backoffice action that clears a candidate's given answers and start timestamp for a quiz, closes #20. * fix: wrap candidate progress reset in a transaction Avoids leaving a candidate half-reset (answers deleted but started still set) if the second flush fails. Addresses CodeRabbit review comment on PR #204. * feat: open candidate edit/add forms in modals with dirty-aware dismissal Rename-candidate modal always blocked backdrop-click dismissal via a hardcoded static backdrop; wire it into the existing bo--modal controller so outside clicks/Escape only get blocked once the name field has actually been edited. Also move "Add Candidate" from a full-page navigation into the same turbo-frame modal pattern already used for editing quiz questions, keeping the full-page form as a fallback for non-JS/turbo requests. * feat: show a hint for the candidates textarea and gate translations in CI Add a help hint on the add-candidates form explaining one candidate per line, and translate it plus a few strings from the earlier reset-progress feature that had been missed. Also add a CI step that re-runs translation:extract and fails the build if it produces uncommitted changes, so untranslated/stale strings can't slip through review again. * Just links
136 lines
4.3 KiB
Makefile
136 lines
4.3 KiB
Makefile
# Load per-worktree overrides (project name, image tag, ports) generated by `just init`
|
|
set dotenv-load := true
|
|
set dotenv-filename := ".env.local"
|
|
|
|
# Generate a per-worktree COMPOSE_PROJECT_NAME, IMAGES_PREFIX and free host ports in .env.local,
|
|
# so multiple worktrees/checkouts of this repo can run `just up` at the same time without their
|
|
# containers, volumes, images or ports colliding. Safe to re-run; no-ops if already configured.
|
|
init:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ -f .env.local ] && grep -q '^COMPOSE_PROJECT_NAME=' .env.local; then
|
|
echo ".env.local already configured for this worktree, skipping (delete it to regenerate)."
|
|
exit 0
|
|
fi
|
|
free_port() {
|
|
local port="$1" max="$2"
|
|
while [ "$port" -le "$max" ]; do
|
|
if ! (exec 3<>/dev/tcp/127.0.0.1/"$port") 2>/dev/null; then
|
|
echo "$port"
|
|
return
|
|
fi
|
|
exec 3>&- 2>/dev/null || true
|
|
port=$((port + 1))
|
|
done
|
|
echo "no free port found between $1 and $2" >&2
|
|
exit 1
|
|
}
|
|
if command -v sha1sum >/dev/null 2>&1; then
|
|
hash_cmd=(sha1sum)
|
|
elif command -v shasum >/dev/null 2>&1; then
|
|
hash_cmd=(shasum)
|
|
else
|
|
hash_cmd=(sha256sum)
|
|
fi
|
|
hash=$(pwd | "${hash_cmd[@]}" | cut -c1-8)
|
|
project="tvdt-${hash}"
|
|
http_port=$(free_port 8080 8179)
|
|
https_port=$(free_port 8443 8542)
|
|
postgres_port=$(free_port 5430 5529)
|
|
mailpit_port=$(free_port 8025 8124)
|
|
spotlight_port=$(free_port 8969 9068)
|
|
{
|
|
echo "COMPOSE_PROJECT_NAME=${project}"
|
|
echo "IMAGES_PREFIX=${project}-"
|
|
echo "HTTP_PORT=${http_port}"
|
|
echo "HTTPS_PORT=${https_port}"
|
|
echo "POSTGRES_PORT=${postgres_port}"
|
|
echo "MAILPIT_PORT=${mailpit_port}"
|
|
echo "SPOTLIGHT_PORT=${spotlight_port}"
|
|
} >> .env.local
|
|
echo "Generated .env.local for this worktree:"
|
|
cat .env.local
|
|
|
|
up *args: init
|
|
#!/usr/bin/env bash
|
|
set -a
|
|
[ -f .env.local ] && source .env.local
|
|
set +a
|
|
docker compose up -d {{ args }}
|
|
|
|
down *args:
|
|
docker compose down --remove-orphans {{ args }}
|
|
|
|
# Show the URLs (and DB connection) assigned to this worktree (see `just init`)
|
|
ports:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ ! -f .env.local ]; then
|
|
echo "No .env.local yet, run 'just up' or 'just init' first."
|
|
exit 0
|
|
fi
|
|
set -a
|
|
source .env.local
|
|
set +a
|
|
echo "Tvdt: https://localhost:${HTTPS_PORT}"
|
|
echo "Mailpit: http://localhost:${MAILPIT_PORT}"
|
|
echo "Spotlight: http://localhost:${SPOTLIGHT_PORT}"
|
|
|
|
stop:
|
|
docker compose stop
|
|
|
|
exec *args:
|
|
docker compose exec php {{ args }}
|
|
|
|
[no-exit-message]
|
|
shell:
|
|
@docker compose exec php bash
|
|
|
|
[no-exit-message]
|
|
shell-run:
|
|
@docker compose run --rm php bash
|
|
|
|
migrate: up
|
|
docker compose run --rm php bin/console doctrine:migrations:migrate --no-interaction
|
|
|
|
fixtures:
|
|
docker compose exec php bin/console doctrine:fixtures:load --purge-with-truncate --no-interaction --group=dev
|
|
|
|
translations:
|
|
docker compose exec php bin/console translation:extract --force --format=xliff --sort=asc nl
|
|
|
|
fix-cs:
|
|
docker compose exec php vendor/bin/php-cs-fixer fix
|
|
docker compose exec php vendor/bin/twig-cs-fixer fix
|
|
|
|
rector *args:
|
|
docker compose exec php vendor/bin/rector {{ args }}
|
|
|
|
phpstan *args:
|
|
docker compose exec php vendor/bin/phpstan analyse {{ args }}
|
|
|
|
test *args:
|
|
docker compose exec php vendor/bin/phpunit {{ args }}
|
|
|
|
[confirm]
|
|
clean:
|
|
docker compose down -v --remove-orphans
|
|
rm -rf vendor var assets/vendor public/assets public/bundles .php-cs-fixer.cache .twig-cs-fixer.cache
|
|
|
|
reload-tests:
|
|
@docker compose exec php bin/console --env=test doctrine:database:drop --if-exists --force
|
|
@docker compose exec php bin/console --env=test doctrine:database:create
|
|
@docker compose exec php bin/console --env=test doctrine:migrations:migrate -n
|
|
@docker compose exec php bin/console --env=test doctrine:fixtures:load -n --group=test
|
|
|
|
install-hooks:
|
|
git config core.hooksPath .githooks
|
|
chmod +x .githooks/pre-commit
|
|
@echo "Pre-commit hook installed."
|
|
|
|
trust-cert:
|
|
sudo security add-trusted-cer -d \
|
|
-r trustRoot \
|
|
-k "$HOME/Library/Keychains/login.keychain" \
|
|
./frankenphp/data/caddy/pki/authorities/local/root.crt
|