Skip to content

work item example calling wrong function #7

Description

@jcyh0120

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions