Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Rename and delete sum after using it for sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed Sep 19, 2014
1 parent 79350c9 commit 5b8a6c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/questions/disconnect.categories.organizations.sh
Expand Up @@ -39,9 +39,12 @@ def domainWithValue:
| map(
reduce .[1:][] as $item (
.[0]
| .domains = domainWithValue;
| .domains = domainWithValue
| .sum = .value
| del(.value);
.domains += ($item | domainWithValue)
| .value += $item.value
# The .sum isn't representative as it doesn't represent coverage any more.
| .sum += $item.value
)
| .domains |= (
to_entries
Expand All @@ -52,6 +55,10 @@ def domainWithValue:
)
| sort_by(.value)
| reverse
# Delete .sum as the number can only be used for sorting.
| map(
del(.sum)
)
)
EOF

Expand Down

0 comments on commit 5b8a6c8

Please sign in to comment.