qa: Update scripts

This commit is contained in:
nemunaire 2023-07-25 09:21:11 +02:00
parent d2f409db7a
commit d4990916b5
6 changed files with 77 additions and 24 deletions

20
qa-fill-view-overview.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
source qa-common.sh
TEAM_OVERVIEW=$1
# Register Teams association betweeen "FIC Groupe X" and X, the theme directory prefix
`curl -s http://${HOST_FICADMIN}/api/teams | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read ID TEAM; do if echo $TEAM | grep "${TEAM_PREFIX}" > /dev/null 2> /dev/null; then echo export TEAM_$TEAM=$ID | sed -r "s/${TEAM_PREFIX} //"; fi; done`
# Add all themes and exercices to assistants
curl -s http://${HOST_FICADMIN}/api/themes | jq '.[].id' | while read tid
do
TEAM="TEAM_$(curl -s http://${HOST_FICADMIN}/api/themes/$tid | jq -r .path | sed -r 's/^[^0-9]*([0-9]+)-.*$/\1/')"
curl -s http://${HOST_FICADMIN}/api/themes/$tid/exercices | jq .[].id | while read ex
do
curl -X POST -d @- -H "X-FIC-Team: ${QA_ADMIN}" http://${HOST_FICQA}/api/qa_my_exercices.json <<EOF
{"id_team": ${TEAM_OVERVIEW}, "id_exercice": $ex}
EOF
done
done