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

work item example calling wrong function #7

Open
jcyh0120 opened this issue Jun 12, 2015 · 0 comments
Open

work item example calling wrong function #7

jcyh0120 opened this issue Jun 12, 2015 · 0 comments

Comments

@jcyh0120
Copy link

I just saw this awesome project and tried to copy the Work item example code, pasted it to a js file.
Then, I run node "myfilename".js

It came out with the following error:

D:\nodejs>node test.js
D:\nodejs\test.js:94
          .schedule(function(d) { return d.availability ? p(d.availability) :
           ^
TypeError: undefined is not a function
    at Object.<anonymous> (D:\nodejs\test.js:94:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

D:\nodejs>node test.js
D:\nodejs\test.js:105
          .schedule(function(d) { return d.availability ? p(d.availability) :
           ^
TypeError: undefined is not a function
    at Object.<anonymous> (D:\nodejs\test.js:105:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

I think the demo code calls the wrong function at Line:94 , 105

89 var t = schedule.tasks()
90           .id(function(d) { return d.name; })
91           // our length is in hours, convert to minutes
92           .duration(function(d) { return d.length * 60; })
93           // use later.parse.text to parse text into a usable schedule
94          .schedule(function(d) { return d.availability ? p(d.availability) : undefined; })
95           // convert minSchedule to minutes
96           .minSchedule(function(d) { return d.minSchedule ? d.minSchedule * 60 : undefined; })
97           // resources are the people the tasks have been assigned to
98           .resources(function(d) { return d.assignedTo; });
.
.
.
105         .schedule(function(d) { return d.availability ? p(d.availability) : undefined; });


I changed all the ".schedule" to ".available", then it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant