Skip to content

Commit

Permalink
Merge pull request #99 from buildingSMART/ALS016_IVS-20_frontend-parsing
Browse files Browse the repository at this point in the history
add formatting for displaying results of alignment continuity formatting
  • Loading branch information
Ghesselink authored Sep 10, 2024
2 parents 869ba50 + 781b85e commit f8526ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/GherkinResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ function unsafe_format(obj) {
} else if (typeof obj == 'object' && 'oneOf' in obj) {
let ctx = obj.context ? `${obj.context.charAt(0).toUpperCase()}${obj.context.slice(1)} one of:` : `One of:`
return <div>{ctx}<div></div><ul>{obj.oneOf.map(v =><li>{v}</li>)}</ul></div>
} else if (typeof obj== 'object' && 'num_digits' in obj) {
// custom formatting for calculated alignment consistency (e.g. ALS016, ALS017, ALS018)
console.log(`object is ${obj.expected}`);
let ctx = obj.context ? `${obj.context.charAt(0).toUpperCase()}${obj.context.slice(1)} :` : `One of:`
let value = obj.expected || obj.observed;
let display_value = value.toExponential(obj.num_digits);
return <div>{ctx} {display_value}</div>
} else {
return JSON.stringify(obj);
}
Expand Down

0 comments on commit f8526ed

Please sign in to comment.