qa: Update scripts
This commit is contained in:
parent
d2f409db7a
commit
d4990916b5
24
qa-add-todo.sh
Executable file
24
qa-add-todo.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
source qa-common.sh
|
||||
|
||||
TEAMNUM=$1
|
||||
THEMETODO=$2
|
||||
MIN_EXO_TODO=$3
|
||||
[ $# -gt 3 ] && MAX_EXO_TODO=$4 || MAX_EXO_TODO=$MIN_EXO_TODO
|
||||
MIN_EXO_TODO=$(($MIN_EXO_TODO - 1))
|
||||
|
||||
curl -s http://${HOST_FICADMIN}/api/teams | jq -r '.[] | [(.id | tostring), " ", .name] | add' | grep "${TEAM_PREFIX} ${TEAMNUM}" | while read TEAMID TEAMSTR
|
||||
do
|
||||
if echo $TEAMSTR | grep "${TEAM_PREFIX}" > /dev/null 2> /dev/null
|
||||
then
|
||||
GRPFIC=$(echo $TEAMSTR | sed -r "s/${TEAM_PREFIX} //")
|
||||
|
||||
curl -s http://${HOST_FICADMIN}/api/themes.json | jq -r '.["'$THEMETODO'"] | .exercices['$MIN_EXO_TODO:$MAX_EXO_TODO'] | .[].id' | while read EXID
|
||||
do
|
||||
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
|
11
qa-common.sh
Normal file
11
qa-common.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
HOST_FICADMIN=127.0.0.1:8081
|
||||
HOST_FICQA=127.0.0.1:8083
|
||||
|
||||
TEAM_PREFIX="Groupe"
|
||||
QA_ADMIN="${QA_ADMIN:-nemunaire}"
|
||||
|
||||
NB_THEMES_TODO=3
|
||||
MIN_LVL_TODO=1
|
||||
MAX_LVL_TODO=5
|
@ -1,25 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
NB_THEMES_TODO=3
|
||||
MIN_LVL_TODO=1
|
||||
MAX_LVL_TODO=3
|
||||
#!/bin/bash
|
||||
|
||||
source qa-common.sh
|
||||
|
||||
MIN_EXO_TODO=$(($MIN_LVL_TODO - 1))
|
||||
MAX_EXO_TODO=$(($MAX_LVL_TODO - 1))
|
||||
MAX_EXO_TODO=$(($MAX_LVL_TODO))
|
||||
|
||||
curl -s http://127.0.0.1:8081/api/teams/ | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read TEAMID TEAMSTR
|
||||
curl -s http://${HOST_FICADMIN}/api/teams | jq -r '.[] | [(.id | tostring), " ", .name] | add' | while read TEAMID TEAMSTR
|
||||
do
|
||||
if echo $TEAMSTR | grep "FIC Groupe" > /dev/null 2> /dev/null
|
||||
if echo $TEAMSTR | grep "${TEAM_PREFIX}" > /dev/null 2> /dev/null
|
||||
then
|
||||
GRPFIC=$(echo $TEAMSTR | sed -r 's/FIC Groupe //')
|
||||
GRPFIC=$(echo $TEAMSTR | sed -r "s/${TEAM_PREFIX} //")
|
||||
|
||||
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/$/"/')
|
||||
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/$/"/')
|
||||
|
||||
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
|
||||
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
|
||||
#curl -X POST -d @- -H "X-FIC-Team: nemunaire" http://127.0.0.1:8083/api/qa_work.json <<EOF
|
||||
cat <<EOF
|
||||
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
|
||||
|
20
qa-fill-view-overview.sh
Executable file
20
qa-fill-view-overview.sh
Executable 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
|
@ -1,15 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
source qa-common.sh
|
||||
|
||||
# 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`
|
||||
`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 their themes and exercices
|
||||
curl -s http://127.0.0.1:8081/api/themes | jq '.[].id' | while read tid
|
||||
curl -s http://${HOST_FICADMIN}/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
|
||||
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: nemunaire" http://127.0.0.1:8083/api/qa_my_exercices.json <<EOF
|
||||
[ -z "${!TEAM}" ] || curl -X POST -d @- -H "X-FIC-Team: ${QA_ADMIN}" http://${HOST_FICQA}/api/qa_my_exercices.json <<EOF
|
||||
{"id_team": ${!TEAM}, "id_exercice": $ex}
|
||||
EOF
|
||||
done
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
[ $# -lt 1 ] && { >&2 echo "Please give DB to read from as argument"; exit 1; }
|
||||
|
||||
source qa-common.sh
|
||||
|
||||
MYSQL_USER="${MYSQL_USER:-fic}"
|
||||
MYSQL_PASSWORD="${MYSQL_PASSWORD:-fic}"
|
||||
MYSQL_DATABASE="$1"
|
||||
|
||||
QA_ADMIN="${QA_ADMIN:-nemunaire@nemunai.re}"
|
||||
|
||||
EXERCICES=$(curl -s -H "X-FIC-Team: ${QA_ADMIN}" http://127.0.0.1:8083/api/exercices/)
|
||||
TEAMS=$(curl -s http://127.0.0.1:8081/api/teams/ | jq -r '.[].id' | while read IDTEAM; do curl -s http://127.0.0.1:8081/api/teams/$IDTEAM/associations | jq -r ".[] | {login: ., id_team: \"$IDTEAM\"}"; done)
|
||||
EXERCICES=$(curl -s -H "X-FIC-Team: ${QA_ADMIN}" http://${HOST_FICQA}/api/exercices/)
|
||||
TEAMS=$(curl -s http://${HOST_FICADMIN}/api/teams/ | jq -r '.[].id' | while read IDTEAM; do curl -s http://${HOST_FICADMIN}/api/teams/$IDTEAM/associations | jq -r ".[] | {login: ., id_team: \"$IDTEAM\"}"; done)
|
||||
|
||||
echo "select Q.*, T.name, E.title from exercices_qa Q INNER JOIN exercices E ON E.id_exercice = Q.id_exercice INNER JOIN themes T ON T.id_theme = E.id_theme;" | mysql --skip-column-names -u "${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" | tr '\t' '|' | while IFS='|' read IDQ IDEXERCICE IDTEAM REMOTE_USER SUBJECT CREATION STATE SOLVED CLOSED THEME EXERCICE_TITLE
|
||||
do
|
||||
@ -30,7 +30,7 @@ $SUBJECT
|
||||
EOF
|
||||
)
|
||||
|
||||
QA=$(curl -s -f -X POST -d @- "http://127.0.0.1:8081/api/qa/" <<EOF
|
||||
QA=$(curl -s -f -X POST -d @- "http://${HOST_FICADMIN}/api/qa/" <<EOF
|
||||
{
|
||||
"id_exercice": $IDEXERCICE,
|
||||
"id_team": $IDTEAM,
|
||||
@ -58,7 +58,7 @@ $COMMENT
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -s -f -X POST -d @- "http://127.0.0.1:8081/api/qa/$QAID/comments" <<EOF > /dev/null
|
||||
curl -s -f -X POST -d @- "http://${HOST_FICADMIN}/api/qa/$QAID/comments" <<EOF > /dev/null
|
||||
{
|
||||
"id_team": $IDTEAM,
|
||||
"user": "$REMOTE_USER",
|
||||
|
Loading…
Reference in New Issue
Block a user