QA: Add new script to migrate QA content from a DB to another
This commit is contained in:
parent
2cf9723c6c
commit
f4dcaa23a3
8 changed files with 208 additions and 9 deletions
16
qa-fill-view.sh
Executable file
16
qa-fill-view.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Register Teams association betweeen "FIC Groupe X" and X, the theme directory prefix
|
||||
`curl -s http://127.0.0.1:8081/api/teams/ | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read ID TEAM; do if echo $TEAM | grep "FIC Groupe" > /dev/null 2> /dev/null; then echo TEAM_$TEAM=$ID | sed -r 's/FIC Groupe //'; fi; done`
|
||||
|
||||
# Add their themes and exercices
|
||||
curl -s http://127.0.0.1:8081/api/themes | jq '.[].id' | while read tid
|
||||
do
|
||||
TEAM="TEAM_$(curl -s http://127.0.0.1:8081/api/themes/$tid | jq -r .path | sed -r 's/-.*$//')"
|
||||
curl -s http://127.0.0.1:8081/api/themes/$tid/exercices | jq .[].id | while read ex
|
||||
do
|
||||
curl -X POST -d @- -H "X-FIC-Team: nemunaire" http://127.0.0.1:8083/api/qa_my_exercices.json <<EOF
|
||||
{"id_team": ${!TEAM}, "id_exercice": $ex}
|
||||
EOF
|
||||
done
|
||||
done
|
||||
Reference in a new issue