#683: use >= 0 for sign selection in badge.xsl to avoid displaying -0#697
Open
morphqdd wants to merge 1 commit into
Open
#683: use >= 0 for sign selection in badge.xsl to avoid displaying -0#697morphqdd wants to merge 1 commit into
morphqdd wants to merge 1 commit into
Conversation
Contributor
Author
|
@yegor256, please take a look when you have a moment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #683.
xsl/badge.xsl's sign-selection branch used strict$avg > 0, so when$avgis exactly"0.0"(zero facts, or a rounded-to-zero average), the condition is false and the otherwise-branch emits
-, whileabs($avg)emits0— the badge shows-0.Widened the sign check to
$avg >= 0, matching the existing correct pattern already used forcolor selection in
vitals.xsl($i >= 0).Added
test_shows_plus_zero_when_average_is_exactly_zerototest/pages/test_badge.rb, whichtransforms a minimal
<fb/>(zero facts → avg =0.0) through the realbadge.xslvia Saxon andasserts the rendered text is
+0, not-0.Verified directly with Saxon-HE 9.8.0-5 (downloaded jar): confirmed the badge renders
-0withoutthe fix and
+0with the fix, for the same zero-average input.Note: I could not run this new test locally through Minitest —
qbash(used by the existingxslt()test helper and my new test) hardcodes/bin/bash, which doesn't exist on this NixOSsandbox — but this is an environment artifact unrelated to the change (confirmed via a direct
Saxon invocation outside the test harness, and the real CI
testjob runs on Ubuntu where/bin/bashexists).