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
27
qa-fill-todo.sh
Executable file
27
qa-fill-todo.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
NB_THEMES_TODO=3
|
||||
MIN_LVL_TODO=1
|
||||
MAX_LVL_TODO=3
|
||||
|
||||
|
||||
MIN_EXO_TODO=$(($MIN_LVL_TODO - 1))
|
||||
MAX_EXO_TODO=$(($MAX_LVL_TODO - 1))
|
||||
|
||||
curl -s http://127.0.0.1:8081/api/teams/ | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read TEAMID TEAMSTR
|
||||
do
|
||||
if echo $TEAMSTR | grep "FIC Groupe" > /dev/null 2> /dev/null
|
||||
then
|
||||
GRPFIC=$(echo $TEAMSTR | sed -r 's/FIC Groupe //')
|
||||
|
||||
THEMES_TO_TESTS=$(curl -s http://127.0.0.1:8081/api/themes | jq -r '.[] | [(.id | tostring), " ", (.path | split("-") | .[0])] | add' | grep -v " $GRPFIC" | shuf | head -n $NB_THEMES_TODO | cut -d " " -f 1 | xargs | sed 's/^/"/;s/ /","/g;s/$/"/')
|
||||
|
||||
curl -s http://127.0.0.1:8081/api/themes.json | jq -r '.['$THEMES_TO_TESTS'] | .exercices | keys | .['$MIN_EXO_TODO:$MAX_EXO_TODO'] | .[]' | while read EXID
|
||||
do
|
||||
#curl -X POST -d @- -H "X-FIC-Team: nemunaire" http://127.0.0.1:8083/api/qa_work.json <<EOF
|
||||
cat <<EOF
|
||||
{"id_team": $TEAMID, "id_exercice": $EXID}
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
done
|
||||
Reference in a new issue