server/qa-fill-todo.sh

24 lines
934 B
Bash
Raw Normal View History

2023-07-25 07:21:11 +00:00
#!/bin/bash
2023-07-25 07:21:11 +00:00
source qa-common.sh
MIN_EXO_TODO=$(($MIN_LVL_TODO - 1))
2023-07-25 07:21:11 +00:00
MAX_EXO_TODO=$(($MAX_LVL_TODO))
2023-07-25 07:21:11 +00:00
curl -s http://${HOST_FICADMIN}/api/teams | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read TEAMID TEAMSTR
do
2023-07-25 07:21:11 +00:00
if echo $TEAMSTR | grep "${TEAM_PREFIX}" > /dev/null 2> /dev/null
then
2023-07-25 07:21:11 +00:00
GRPFIC=$(echo $TEAMSTR | sed -r "s/${TEAM_PREFIX} //")
2023-07-25 07:21:11 +00:00
THEMES_TO_TESTS=$(curl -s http://${HOST_FICADMIN}/api/themes | jq -r '.[] | [(.id | tostring), " ", (.path | split("-") | .[0])] | add' | grep -v " grp$GRPFIC" | shuf | head -n $NB_THEMES_TODO | cut -d " " -f 1 | xargs | sed 's/^/"/;s/ /","/g;s/$/"/')
2023-07-25 07:21:11 +00:00
curl -s http://${HOST_FICADMIN}/api/themes.json | jq -r '.['$THEMES_TO_TESTS'] | .exercices['$MIN_EXO_TODO:$MAX_EXO_TODO'] | .[].id' | while read EXID
do
2023-07-25 07:21:11 +00:00
curl -X POST -d @- -H "X-FIC-Team: ${QA_ADMIN}" http://${HOST_FICQA}/api/qa_work.json <<EOF
{"id_team": $TEAMID, "id_exercice": $EXID}
EOF
done
fi
done