Skip to content

Commit

Permalink
Adjust field order in update-stake and weigh-votes
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeams committed Nov 9, 2017
1 parent b5892d7 commit bb2e4ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion update-stake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cp $STAKE_FILE $STAKE_FILE_TMP1
for APPROVED_COMPENSATION_REQUEST_FILE in $(cat $VOTING_RESULTS_FILE | awk -F, '{if ($2 > 0) print $1}'); do
sort $APPROVED_COMPENSATION_REQUEST_FILE \
| join -t, -a1 $STAKE_FILE_TMP1 - \
| awk -F, '{old_bal=$4; comp=$6; new_bal=old_bal+comp; printf("%s,%s,%s,%s\n", $1, $2, $3, new_bal)}' > $STAKE_FILE_TMP2 \
| awk -F, '{old_bal=$4; comp=$5; new_bal=old_bal+comp; printf("%s,%s,%s,%s\n", $1, $2, $3, new_bal)}' > $STAKE_FILE_TMP2 \
&& mv $STAKE_FILE_TMP2 $STAKE_FILE_TMP1
done \
&& mv $STAKE_FILE_TMP1 $STAKE_FILE
Expand Down
2 changes: 1 addition & 1 deletion weigh-votes
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ elif [ -f "$PATH_ARG" ]; then

sort $PATH_ARG \
| join -t, $STAKE_FILE - \
| awk -F, -v path=$PATH_ARG '{vote=$5; stake=$4; weight+=vote*stake} END {printf("%s,%d\n", path, weight)}'
| awk -F, -v path=$PATH_ARG '{vote=$6; stake=$4; weight+=vote*stake} END {printf("%s,%d\n", path, weight)}'

else

Expand Down

0 comments on commit bb2e4ef

Please sign in to comment.