Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 3b3a3a99 authored by Antoine Blanquet's avatar Antoine Blanquet
Browse files

Adding Code Passive Active Detection (merging)+ merge code MomentJs(Not...

Adding Code Passive Active Detection (merging)+ merge code MomentJs(Not working; Issue Created), changing names files with uppercase
parent 3b0a966e
{
"totalCount": "21",
"totalCount": "22",
"result": [
{
"id": "e24f43fffe44d05f",
......@@ -51,7 +51,7 @@
},
{
"id": "e24f43fffe44d333",
"lastState": "active"
"lastState": "passive"
},
{
"id": "e24f43fffe44d13a",
......@@ -73,6 +73,10 @@
"id": "70b3d58ff1004297",
"lastState": "active"
},
{
"id": "aabbccddeeff0011",
"lastState": "passive"
},
{
"id": "e24f43fffe44cff3",
"lastState": "passive"
......@@ -83,7 +87,7 @@
},
{
"id": "e24f43fffe44cf96",
"lastState": "passive"
"lastState": "active"
}
]
}
......@@ -117,7 +117,7 @@ jq --raw-output -f devices_to_html.jq ${DATA_DEV_FOLDER}.devices.json | grep -v
echo '</body></html>' >> .devices.html
# ./get_id_devicesChange.sh
./get_id_devices_change.sh
for ((i=0; i<${#DID[@]}; i++))
......
......@@ -78,4 +78,4 @@ echo "generate html (with sparkline)"
./gateways_to_html.sh $GATEWAYS_LEN $GATEWAYS $TODAY
echo "Passive Active Check"
# ./get_id_gatewaysChange.sh
\ No newline at end of file
./get_id_gateways_change.sh
\ No newline at end of file
......@@ -47,7 +47,7 @@ done
#On stock les ids des devices d'hier
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}lastdevicesStates.json)
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}last_devices_states.json)
id_2=()
i=0
for ID in $ids_2
......@@ -57,7 +57,7 @@ do
done
#On stock les states des devices d'hier
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}lastdevicesStates.json)
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}last_devices_states.json)
states_2=()
j=0
for s in $full_state
......@@ -90,24 +90,25 @@ do
done
if [[ ${date[$i]} != "null" ]]
then
tmp=$(grep ${id[$i]} < .devices.html)
dateFromNow=$(node changeDateMomentjs.js ${date[$i]})
replacement=${tmp/${date[$i]}/"$dateFromNow"}
sed -i "/${id[$i]}/c $replacement" .devices.html
echo "on change la date ici"
# tmp=$(grep ${id[$i]} < .devices.html)
# dateFromNow=$(node change_date_momentjs.js ${date[$i]})
# replacement=${tmp/${date[$i]}/"$dateFromNow"}
# sed -i "/${id[$i]}/c $replacement" .devices.html
fi
done
#On met à jour les states des devices pour le prochain jour
echo "{
\"totalCount\": \"${#id[@]}\",
\"result\": [" > ${DATA_DEV_FOLDER}lastdevicesStates.json
\"result\": [" > ${DATA_DEV_FOLDER}last_devices_states.json
for (( i=0; i<$((${#id[@]}-1)); i++ ))
do
echo " {
\"id\": \"${id[$i]}\",
\"lastState\": \"${state[$i]}\"
}," >> ${DATA_DEV_FOLDER}lastdevicesStates.json
}," >> ${DATA_DEV_FOLDER}last_devices_states.json
done
echo " {
......@@ -115,4 +116,4 @@ echo " {
\"lastState\": \"${state[$((${#id[@]}-1))]}\"
}
]
}" >> ${DATA_DEV_FOLDER}lastdevicesStates.json
\ No newline at end of file
}" >> ${DATA_DEV_FOLDER}last_devices_states.json
\ No newline at end of file
......@@ -46,7 +46,7 @@ do
done
#We store yesterday gateways ids
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_GAT_FOLDER}lastGatewaysStates.json)
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_GAT_FOLDER}last_gateways_states.json)
id_2=()
i=0
for ID in $ids_2
......@@ -56,7 +56,7 @@ do
done
#We store yesterday gateways states
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_GAT_FOLDER}lastGatewaysStates.json)
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_GAT_FOLDER}last_gateways_states.json)
states_2=()
j=0
for s in $full_state
......@@ -89,24 +89,25 @@ do
done
if [[ ${date[$i]} != "null" ]]
then
tmp=$(grep ${id[$i]} < .gateways.html)
dateFromNow=$(node changeDateMomentjs.js ${date[$i]})
replacement=${tmp/${date[$i]}/"$dateFromNow"}
sed -i "/${id[$i]}/c $replacement" .gateways.html
echo "on change la date ici"
# tmp=$(grep ${id[$i]} < .gateways.html)
# dateFromNow=$(node change_date_momentjs.js ${date[$i]})
# replacement=${tmp/${date[$i]}/"$dateFromNow"}
# sed -i "/${id[$i]}/c $replacement" .gateways.html
fi
done
#We update gateways state for the next day
echo "{
\"totalCount\": \"${#id[@]}\",
\"result\": [" > ${DATA_GAT_FOLDER}lastGatewaysStates.json
\"result\": [" > ${DATA_GAT_FOLDER}last_gateways_states.json
for (( i=0; i<$((${#id[@]}-1)); i++ ))
do
echo " {
\"id\": \"${id[$i]}\",
\"lastState\": \"${state[$i]}\"
}," >> ${DATA_GAT_FOLDER}lastGatewaysStates.json
}," >> ${DATA_GAT_FOLDER}last_gateways_states.json
done
echo " {
......@@ -114,4 +115,4 @@ echo " {
\"lastState\": \"${state[$((${#id[@]}-1))]}\"
}
]
}" >> ${DATA_GAT_FOLDER}lastGatewaysStates.json
\ No newline at end of file
}" >> ${DATA_GAT_FOLDER}last_gateways_states.json
\ No newline at end of file
{
"totalCount": "23",
"result": [
{
"id": "0000024b0805031a",
"lastState": "active"
},
{
"id": "7276ff0039030716",
"lastState": "active"
},
{
"id": "7276ff0039030724",
"lastState": "active"
},
{
"id": "7276ff0039030871",
"lastState": "active"
},
{
"id": "0080e1ffff0153f1",
"lastState": "passive"
},
{
"id": "0080e1ffff011234",
"lastState": "passive"
},
{
"id": "0080e1ffff0153d7",
"lastState": "passive"
},
{
"id": "080027ffff052e4a",
"lastState": "passive"
},
{
"id": "0080e1ffff014fe1",
"lastState": "passive"
},
{
"id": "0080e1ffff014feb",
"lastState": "passive"
},
{
"id": "0080e1ffff01523c",
"lastState": "passive"
},
{
"id": "0080e1ffff01523e",
"lastState": "passive"
},
{
"id": "0080e1ffff015240",
"lastState": "passive"
},
{
"id": "0080e1ffff015241",
"lastState": "passive"
},
{
"id": "0080e1ffff015242",
"lastState": "passive"
},
{
"id": "0080e1ffff015244",
"lastState": "passive"
},
{
"id": "0080e1ffff015252",
"lastState": "passive"
},
{
"id": "0080e1ffff015253",
"lastState": "passive"
},
{
"id": "0080e1ffff015256",
"lastState": "passive"
},
{
"id": "0080e1ffff015257",
"lastState": "passive"
},
{
"id": "0080e1ffff01525e",
"lastState": "passive"
},
{
"id": "0080e1ffff0153cc",
"lastState": "passive"
},
{
"id": "0080e1ffff015abf",
"lastState": "passive"
}
]
}
{
"totalCount": "0",
"result": [
{
"id": "",
"lastState": ""
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment