-
Notifications
You must be signed in to change notification settings - Fork 20
Fix: FK reading grade of 0 < x < 1 collapses to 0 (normalize to 1) #1725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pattonwebz
merged 3 commits into
develop
from
steve/pro-626-bug-fk-reading-grade-of-0-x-1-collapses-to-0-should
Jul 8, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
a3d0cff
Fix: normalize FK grade values in (0,1) to 1 instead of collapsing to 0
SteveJonesDev dfa89d2
Fix: handle false/null from TextStatistics in edac_normalize_fk_grade
pattonwebz e616ede
chore: use x.x.x placeholder for @since tags on new function
pattonwebz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
| /** | ||
| * Tests for the edac_normalize_fk_grade helper. | ||
| * | ||
| * @package Accessibility_Checker | ||
| * @since 1.44.0 | ||
| */ | ||
|
|
||
| /** | ||
| * Tests for edac_normalize_fk_grade. | ||
| * | ||
| * @covers ::edac_normalize_fk_grade | ||
| * @since 1.44.0 | ||
| */ | ||
| class NormalizeFkGradeTest extends WP_UnitTestCase { | ||
|
|
||
| /** | ||
| * Verifies FK grade normalization for the given input/expected pair. | ||
| * | ||
| * @dataProvider data_normalize_fk_grade | ||
| * | ||
| * @param float $input Raw FK grade float. | ||
| * @param int $expected Expected normalized integer grade. | ||
| */ | ||
| public function test_normalize_fk_grade( float $input, int $expected ) { | ||
| $this->assertSame( $expected, edac_normalize_fk_grade( $input ) ); | ||
| } | ||
|
pattonwebz marked this conversation as resolved.
Outdated
|
||
|
|
||
| /** | ||
| * Data provider for test_normalize_fk_grade. | ||
| * | ||
| * @return array<string, array{float, int}> | ||
| */ | ||
| public static function data_normalize_fk_grade(): array { | ||
| return [ | ||
| 'zero stays zero' => [ 0.0, 0 ], | ||
| 'negative stays zero' => [ -1.5, 0 ], | ||
| 'fractional above zero is 1' => [ 0.01, 1 ], | ||
| 'mid-fraction is 1' => [ 0.5, 1 ], | ||
| 'just below 1.0 is 1' => [ 0.99, 1 ], | ||
| 'exactly 1.0 is 1' => [ 1.0, 1 ], | ||
| '1.9 floors to 1' => [ 1.9, 1 ], | ||
| '9.0 is 9' => [ 9.0, 9 ], | ||
| '9.9 floors to 9' => [ 9.9, 9 ], | ||
| '10.0 is 10' => [ 10.0, 10 ], | ||
| 'whole grade passes through' => [ 5.0, 5 ], | ||
| ]; | ||
| } | ||
|
pattonwebz marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align REST failure threshold with “above 9th grade” semantics.
Line 1083 uses
>= 9, which treats exactly 9th grade as failed. That conflicts with the “above 9th grade” behavior used in other updated paths, so REST/sidebar can disagree with AJAX for grade 9.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally not addressing this in PR #1725 — we've opened a dedicated issue #1797 to fix all the inconsistent grade-9 thresholds across the codebase (including this one and the
class-ajax.php:669case) with proper references to WCAG 3.1.5.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pattonwebzUnderstood — thanks for clarifying. Deferring this from#1725and handling the grade-9 threshold consistency work in#1797makes sense, especially if you want to align all affected paths together with the WCAG 3.1.5 rationale. I’m good to leave this out of the current PR.