fix:repeated STATUS

This commit is contained in:
2025-05-28 16:09:39 +02:00
parent f7d4a54a3d
commit 8d5223343b

View File

@@ -33,9 +33,10 @@ BEGIN {
print "PRIORITY:" prio; print "PRIORITY:" prio;
# Print status (toggle if needed) # Print status (toggle if needed)
bit_status = status == "COMPLETED" ? 1 : 0;
bit_toggle = delta ? 0 : 1; bit_toggle = delta ? 0 : 1;
percent = xor(completed, bit_toggle) ? 100 : 0; percent = xor(bit_status, bit_toggle) ? 100 : 0;
status = xor(completed, bit_toggle) ? "COMPLETED" : "NEEDS-ACTION"; status = xor(bit_status, bit_toggle) ? "COMPLETED" : "NEEDS-ACTION";
print "STATUS:" status print "STATUS:" status
print "PERCENT-COMPLETE:" percent print "PERCENT-COMPLETE:" percent
@@ -48,7 +49,7 @@ BEGIN {
/^SEQUENCE/ && inside { seq = 1; print "SEQUENCE:" $2+1; next } /^SEQUENCE/ && inside { seq = 1; print "SEQUENCE:" $2+1; next }
/^LAST-MODIFIED/ && inside { lm = 1; print "LAST-MODIFIED:" zulu; next } /^LAST-MODIFIED/ && inside { lm = 1; print "LAST-MODIFIED:" zulu; next }
/^PRIORITY:/ && inside { prio = $2; next } /^PRIORITY:/ && inside { prio = $2; next }
/^STATUS:COMPLETED/ && inside { completed = 1; next } /^STATUS/ && inside { status = $2; next }
/^PERCENT-COMPLETE/ && inside { next } # ignore, we take STATUS:COMPLETED as reference /^PERCENT-COMPLETE/ && inside { next } # ignore, we take STATUS:COMPLETED as reference
{ print }' { print }'