Ratio Equal compares the quotient instead of the numerator and denominator

Aperta Adatta ai principianti
#406 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
backend

Direzione di ricerca

Il bug si trova in Ratio.equals in src/datatypes/ratio.ts, che divide il numeratore per il denominatore e confronta i quozienti. equivalent chiama questo metodo e deve mantenere il confronto dei quozienti. Inizia leggendo questi due metodi e l'helper di uguaglianza di Quantity che dovrebbero usare per numeratore e denominatore. È completato quando 1:8 = 2:16 restituisce false, 1:8 != 2:16 restituisce true e 1:8 ~ 2:16 resta true, verificato aggiungendo test accanto ai test esistenti sui ratio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
86
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cqframework/cql-execution

Tutte le issue di cqframework/cql-execution

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.