Skip to content

Conversation

@antvaset
Copy link
Contributor

@antvaset antvaset commented Jul 1, 2025

Closes #1575:

  • Fix the equivalent logic for ratios to make e.g. 1'cm':2'cm' ~ 2'cm':4'cm' evaluate to true. The result is calculated as equivalent(a.numerator * b.denominator, b.numerator * a.denominator).
  • Fix the divide evaluator to make dividing by a 0-valued quantity return null. Previously it threw a NullPointerException.

@github-actions
Copy link

github-actions bot commented Jul 1, 2025

Formatting check succeeded!

@codecov
Copy link

codecov bot commented Jul 1, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 64.92%. Comparing base (cc091d4) to head (00b2b02).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
.../cqf/cql/engine/elm/executing/DivideEvaluator.java 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1576   +/-   ##
=========================================
  Coverage     64.92%   64.92%           
+ Complexity     1981     1976    -5     
=========================================
  Files           499      499           
  Lines         28814    28820    +6     
  Branches       5667     5667           
=========================================
+ Hits          18707    18711    +4     
- Misses         7795     7797    +2     
  Partials       2312     2312           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@antvaset antvaset changed the title #1575: Fixed the implementation of equivalent for ratios #1575: Fixed the implementation of ~ for ratios Jul 1, 2025
@antvaset antvaset changed the title #1575: Fixed the implementation of ~ for ratios #1575: Fixed the implementation of equivalent for ratios Jul 1, 2025
@antvaset antvaset marked this pull request as ready for review July 1, 2025 22:01
@scymtym
Copy link
Contributor

scymtym commented Jul 2, 2025

Sorry I didn't communicate this in the bug report (only here) but I have a branch that fixes Equivalent for Ratio and Quantity as well as the other comparison operators and arithmetic operators for Quantity by adding the required unit conversions. Should I submit that pull request in parallel or wait for this one?

@scymtym
Copy link
Contributor

scymtym commented Jul 3, 2025

I submitted my branch as a pull request for reference.

@antvaset
Copy link
Contributor Author

antvaset commented Jul 3, 2025

Hi @scymtym I'd tackle this separately from the broader "unit-aware quantity operations" feature, so this PR is good to go first while yours is in review. I can jump on to reviewing your PR next (which is very impressive!).

I did like your equivalent implementation better so I've changed this PR to use MultiplyEvaluator.

@antvaset antvaset requested a review from JPercival July 5, 2025 00:57
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
79.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@JPercival JPercival merged commit 5f21af8 into master Jul 11, 2025
6 of 7 checks passed
@JPercival JPercival deleted the fix-1575-ratio-equivalent-logic branch July 11, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Equivalent for Ratio types should use value of the ratio, not compare the numerator and denominator.

5 participants