2021-02-05 15:56:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-07-25 07:21:11 +00:00
|
|
|
source qa-common.sh
|
|
|
|
|
2021-02-05 15:56:27 +00:00
|
|
|
# Register Teams association betweeen "FIC Groupe X" and X, the theme directory prefix
|
2023-07-25 07:21:11 +00:00
|
|
|
`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`
|
2021-02-05 15:56:27 +00:00
|
|
|
|
|
|
|
# Add their themes and exercices
|
2023-07-25 07:21:11 +00:00
|
|
|
curl -s http://${HOST_FICADMIN}/api/themes | jq '.[].id' | while read tid
|
2021-02-05 15:56:27 +00:00
|
|
|
do
|
2023-07-25 07:21:11 +00:00
|
|
|
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
|
2021-02-05 15:56:27 +00:00
|
|
|
do
|
2023-07-25 07:21:11 +00:00
|
|
|
[ -z "${!TEAM}" ] || curl -X POST -d @- -H "X-FIC-Team: ${QA_ADMIN}" http://${HOST_FICQA}/api/qa_my_exercices.json <<EOF
|
2021-02-05 15:56:27 +00:00
|
|
|
{"id_team": ${!TEAM}, "id_exercice": $ex}
|
|
|
|
EOF
|
|
|
|
done
|
|
|
|
done
|