Browse Source

Sort Event in addition to story and out to rollback modules correctly, cf #6

master
LecygneNoir 5 years ago
parent
commit
75f9aae28b
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      rollback_module.sh

+ 7
- 2
rollback_module.sh View File

@ -71,9 +71,14 @@ function rebuild_txt {
sorted+=( "$key" )
done < <(printf '%s\0' "${!translationArray[@]}" | sort -zV)
sortedEvent=()
while IFS= read -rd '' key; do
sortedEvent+=( "$key" )
done < <(printf '%s\0' "${!eventArray[@]}" | sort -zV)
currentEvent=""
currentNode=""
for index in "${!eventArray[@]}"; do
for index in "${!sortedEvent[@]}"; do
# If currentEvent is different than our index, then we just changed event and need to close the precedent
# We also closed the next event in line
if [[ ${currentEvent} != ${index} && "${currentEvent}" != "" ]]; then
@ -109,7 +114,7 @@ function rebuild_txt {
fi
done
done
# At the last of last event, we go outside the loop so we need to close remaining node and event
# At the end of last event, we go outside the loop so we need to close remaining node and event
echo "[/NODE]" >> "${TXT}"
echo >> "${TXT}"
echo "[/EVENT]" >> "${TXT}"

Loading…
Cancel
Save