Skip to content
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

Migration Publicodes v1 (NGC-454) #2240

Merged
merged 45 commits into from
Feb 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ed85512
pkg: update publicodes to 1.0.0-rfc.2
Clemog Dec 19, 2023
b014ffa
feat: migrate "alimentation"
Clemog Dec 19, 2023
24c9b20
feat: migrate "divers"
Clemog Dec 19, 2023
3ad20bb
feat: migrate "logement"
Clemog Dec 19, 2023
e843bf5
feat: migrate "transport"
Clemog Dec 19, 2023
cb2d226
refactor(data): recalcul -> contexte
EmileRolley Jan 18, 2024
e695a63
Revert "feat: migrate "logement""
Clemog Dec 19, 2023
12b552e
feat: migrate "logement
Clemog Dec 19, 2023
d83a6ac
fix: recalcul for CH model
Clemog Dec 19, 2023
590ac86
pkg: update publicodes to 1.0.0-rc.5
Clemog Jan 2, 2024
3421296
fix: recalcul -> contexte in actions/alimentation
EmileRolley Jan 18, 2024
9a95955
fix: syntaxe `contexte`
Clemog Jan 2, 2024
ee61d98
pkg: ajoute la dépendance publicodes pour la doc
Clemog Jan 2, 2024
5c85b1f
pkg: use new @publicodes/react-ui package
Clemog Jan 5, 2024
21fb5ba
pkg: upgrade to publicodes rc.6
EmileRolley Jan 8, 2024
99773dd
fix(build): use publicodes rc.7
EmileRolley Jan 9, 2024
80ce9f0
fix: use the new @publicodes/tools API
EmileRolley Jan 22, 2024
2a802f0
pkg(quick-doc): upgrade publicodes
EmileRolley Jan 24, 2024
5ec341d
fix(personas): nuités -> nuitées
EmileRolley Jan 25, 2024
feef9d1
test: tests all rules of all personas for the optim
EmileRolley Jan 25, 2024
5aca0f4
feat(scripts): don't serialize JSON files with whitespaces to save me…
EmileRolley Feb 2, 2024
d2ffca5
refactor(rules)!: recalcul -> contexte
EmileRolley Feb 12, 2024
9cf8d80
fix(personas): remove unexisting rules from the situation
EmileRolley Feb 12, 2024
fb89561
pkg: upgrade to publicodes@1.0.1
EmileRolley Feb 12, 2024
553eb39
test(optim): use a precision of 14 digit for the nodevalue comparison
EmileRolley Feb 12, 2024
8cae2fc
refactor(optim): don't pretty print json file
EmileRolley Feb 12, 2024
1957a1a
quick-doc: upgrade publicodes packages
EmileRolley Feb 12, 2024
2de9112
pkg: upgrade publicodes packages
EmileRolley Feb 12, 2024
4d66a4a
feat(optim): remove 'optimized' and 'note' attributes from optimized …
EmileRolley Feb 12, 2024
2a0bfb3
fix(rules): recalcul -> contexte
EmileRolley Feb 12, 2024
55fdf93
nitpick: remove forgotten test file
EmileRolley Feb 12, 2024
2c8c02a
feat(test)!: compare all rules for testPersonas and testOptim
EmileRolley Feb 13, 2024
7d13600
pkg: upgrade @incubateur-ademe/nosgestesclimat-scripts
EmileRolley Feb 13, 2024
37421ef
fix(data): correctly renames contexte rules
EmileRolley Feb 13, 2024
fe60e97
fix(test): correctly print out the markdown version
EmileRolley Feb 13, 2024
0db974a
fix(personas): comment deprecated rule
EmileRolley Feb 13, 2024
8433a82
test: don't exit with error when the situation is not to date (temp)
EmileRolley Feb 13, 2024
1f13bb3
tmp: test without optim in the compilation step
EmileRolley Feb 14, 2024
3e114a7
pkg: upgrade @publicodes/tools
EmileRolley Feb 14, 2024
c23450a
fix(optim): use the new publicodes/tools API to avoid to fold the 'se…
EmileRolley Feb 14, 2024
bcccbfd
ci: don't print compilation, translation tests and optim tests result…
EmileRolley Feb 14, 2024
321aefc
ci: better report format
EmileRolley Feb 14, 2024
45aa5ea
pkg: upgrade nosgestesclimat-script
EmileRolley Feb 14, 2024
557fa76
ci: rename the workflow to trigger the pr-updater workflow
EmileRolley Feb 14, 2024
78d1708
ci: improve the report
EmileRolley Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(optim): use a precision of 14 digit for the nodevalue comparison
  • Loading branch information
EmileRolley committed Feb 14, 2024
commit 553eb39acb0f6d39edf8968485107e8bf5f8b2d3
21 changes: 19 additions & 2 deletions tests/testOptim.mjs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ const nbRules = Object.keys(optimRules).length
for (const personaName in localPersonas) {
const persona = localPersonas[personaName]
const errors = []
const warnings = []

if (markdown) {
console.log(`**${personaName}**`)
@@ -45,12 +46,22 @@ for (const personaName in localPersonas) {
}
continue
}

for (const rule in optimRules) {
try {
const base = baseEngine.evaluate(rule).nodeValue
const optim = optimEngine.evaluate(rule).nodeValue

if (base !== optim) {
errors.push({ rule, base, optim })
if (
base !== null &&
optim !== null &&
base.toPrecision(14) === optim.toPrecision(14)
) {
warnings.push({ rule, base, optim })
} else {
errors.push({ rule, base, optim })
}
}
} catch (e) {
errors.push({ rule, base: e.message, optim: null })
@@ -66,7 +77,13 @@ for (const personaName in localPersonas) {
} else {
for (const error of errors) {
console.log(
`${c.magenta(error.rule)}: ${error.base} !== ${error.optim}\n`
`${c.magenta(error.rule)}:\n${error.base} !== ${error.optim}\n`
)
}

for (const warning of warnings) {
console.log(
`${c.yellow(warning.rule)}:\n${warning.base} !== ${warning.optim} (equal with 14 digit precision)\n`
)
}