mmomtchev/igc-xc-score

Scoring is undefined

Djang0 opened this issue · 3 comments

Hello,

I've just updated to 1.6.0 and I got this error:

 var result_ffvl = solver(score_flight, scoring.FFVL).next().value;
                                                     ^

TypeError: Cannot read property 'FFVL' of undefined
    at /Users/lr/Documents/code/IFly/index.js:139:54
    at Array.forEach (<anonymous>)
    at processFlights (/Users/lr/Documents/code/IFly/index.js:112:8)
    at Statement.<anonymous> (/Users/lr/Documents/code/IFly/index.js:434:5)
    at Statement.replacement (/Users/lr/Documents/code/IFly/node_modules/sqlite3/lib/trace.js:25:27)

I tried this :

const {
  scoring,
  solver
} = require('igc-xc-score');
console.log(scoring);
console.log(solver);

... I got this result:

undefined
[GeneratorFunction (anonymous)]

Source code is here : https://raw.githubusercontent.com/Djang0/IFly/master/index.js

Am I missing something ?

Thanks in advance.

I just tried it and it works for me, can you try to delete your node_modules and then reinstall with npm i

No better luck :(

lr@Air-de-Ludovic IFly % npm i

> sqlite3@5.0.2 install /Users/lr/Documents/code/IFly/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[sqlite3] Success: "/Users/lr/Documents/code/IFly/node_modules/sqlite3/lib/binding/napi-v3-darwin-x64/node_sqlite3.node" is installed via remote
npm WARN ifly@1.0.0 No description
npm WARN ifly@1.0.0 No repository field.

added 144 packages from 182 contributors and audited 144 packages in 5.236s

2 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
lr@Air-de-Ludovic IFly % node index.js
[GeneratorFunction (anonymous)]
Connected to the logFly database.
found 226 flights in LogFly. Now processing...
 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 0s | 0/226/Users/lr/Documents/code/IFly/index.js:139
      var result_ffvl = solver(score_flight, scoring.FFVL).next().value;
                                                     ^

TypeError: Cannot read property 'FFVL' of undefined
    at /Users/lr/Documents/code/IFly/index.js:139:54
    at Array.forEach (<anonymous>)
    at processFlights (/Users/lr/Documents/code/IFly/index.js:112:8)
    at Statement.<anonymous> (/Users/lr/Documents/code/IFly/index.js:434:5)
    at Statement.replacement (/Users/lr/Documents/code/IFly/node_modules/sqlite3/lib/trace.js:25:27)
lr@Air-de-Ludovic IFly % 

Node version ?

lr@Air-de-Ludovic IFly % node --version
v14.17.3

@mmomtchev renaming scoring to scoringRules did the trick. thanks.