Skip to content

Commit

Permalink
fix(alternatives): wrong rule name was used in the contexte
Browse files Browse the repository at this point in the history
  • Loading branch information
EmileRolley committed Aug 15, 2024
1 parent 16c6cc9 commit ac80665
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion publicodes-voiture.ui.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* Script to generate all the combinations of the carbon emissions
* Script to generate all the possible combinations of carburants, gabarits and
* motorisations
*/

export default function generateCombinations(rules) {
export default function generateAlternatives(rules) {
const carburants = Object.keys(rules).flatMap((key) => {
if (
key.startsWith("voiture . thermique . carburant") &&
Expand Down Expand Up @@ -45,6 +46,8 @@ export default function generateCombinations(rules) {
"ngc . transport . voiture . motorisation": `'${motorisation}'`,
"ngc . transport . voiture . km": "usage . distance annuelle",
"ngc . transport . voiture . voyageurs": 1,
"ngc . transport . voiture . thermique . consommation aux 100":
"voiture . thermique . consommation",
}

const contexteBaseCost = {
Expand All @@ -68,7 +71,7 @@ export default function generateCombinations(rules) {
valeur: "ngc . transport . voiture",
contexte: {
...contexteBaseEmission,
"voiture . thermique . carburant": `'${carburant}'`,
"ngc . transport . voiture . thermique . carburant": `'${carburant}'`,
},
}
rules[`coût . ${motorisation} . ${gabarit} . ${carburant}`] = {
Expand Down

0 comments on commit ac80665

Please sign in to comment.