fix: comparing against a missing value

If a new package was added, the action would fail as it would try to
subtract `null` from an integer. Instead default to `0`.
This commit is contained in:
Jalil David Salamé Messina 2024-12-22 13:51:51 +01:00
parent 763e139836
commit 1ec7c2a0df
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -2,7 +2,7 @@
#
# Where .[0] is the new value, and .[1] is the old value
def calc_change($key):
. as $input | $input[0][$key] - $input[1][$key];
. as $input | ($input[0][$key] // 0) - ($input[1][$key] // 0);
# Calculate the change in percentage for multiple keys
#