Ratio Equal compares the quotient instead of the numerator and denominator
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
- 领域
- backend
调研方向
问题出在 src/datatypes/ratio.ts 中的 Ratio.equals,它用分子除以分母,然后比较商。equivalent 会调用它,应保留按商比较的逻辑。请先阅读这两个方法,以及它们在比较分子和分母时应使用的 Quantity 相等性辅助函数。当 1:8 = 2:16 返回 false、1:8 != 2:16 返回 true、1:8 ~ 2:16 仍为 true 时即完成。请在现有 ratio 测试旁边添加测试来确认。
由索引模型根据 Issue 内容生成。
描述
Summary
1:8 = 2:16 is true, but Equal (1.5.3 and 2.0) says:
For ratios, this means that the numerator and denominator must be the same, using quantity equality semantics.
The spec's own example is define "RatioEqualIsFalse": 1:8 = 2:16. Comparing the quotients is what Equivalent specifies: "For ratios, equivalent means that the numerator and denominator represent the same ratio (e.g. 1:100 ~ 10:1000)".
| Expression | cql-execution | Spec | Java engine 5.8.0 |
|---|---|---|---|
1:8 = 2:16 |
true |
false |
false |
1:8 != 2:16 |
false |
true |
true |
1:8 = 1:8 |
true |
true |
true |
1:8 ~ 2:16 |
true |
true |
true |
Cause
Ratio.equals (src/datatypes/ratio.ts) divides each numerator by its denominator and compares the results, and Ratio.equivalent calls equals. equals should compare numerator with numerator and denominator with denominator, using Quantity equality. equivalent keeps the quotient comparison.
Environment
cql-execution master e8096c6, through test-server (the build has two unrelated Quantity modulo commits on top). The Java engine column is HAPI FHIR 9.0.0 with clinical-reasoning 4.17.0, through $cql.
- 主要语言
- JavaScript
- 星标
- 86
- 派生
- 40
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cqframework/cql-execution 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
cqframework/cql-execution#410 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
cqframework/cql-execution#407 ·
-
难度 3/5 1-2 天 新手友好度 68/100
cqframework/cql-execution#414 ·
-
难度 3/5 1-2 天 新手友好度 72/100
cqframework/cql-execution#413 ·
-
Length throws TypeError when its null operand is not an As expression (e.g. an expression reference)未关闭
难度 3/5 1-2 天 新手友好度 65/100
cqframework/cql-execution#412 ·
查看 cqframework/cql-execution 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
salesforce/sa11y#1022 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
githubnext/gh-aw-workshop#6379 ·
维护者通常 1 天内回复
-
check:passed logos:edit
难度 1/5 1 小时以内 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
trezor/trezor-user-env#421 ·
-
难度 2/5 1-3 小时 新手友好度 67/100