Skip to content

Custom Constraints (Functions) returning UNDEFINED #7

Description

@robbymichael1

When I pass constraints like this:

const constraints = [ //list of non overlapping constraints
['Tennis', 'Climbing'],
['Handstands', 'Climbing'],
['Trapeze', 'Tennis'],
['Tennis', 'Handstands', 'Trapeze']
]

All works fine. But if I pass functions, like this:

const constraints = [ //list of non overlapping constraints
['Tennis', 'Climbing'],
['Handstands', 'Climbing'],
['Trapeze', 'Tennis'],
['Tennis', 'Handstands', 'Trapeze'],
(timetable) => timetable['8:00'].indexOf('Climbing') !== -1 ? ['Climbing'] : [],
(timetable) => timetable['10:00'].indexOf('Tennis') !== -1 ? ['Climbing'] : [],
(timetable) => timetable['9:00'].indexOf('Trapeze') !== -1 ? ['Climbing'] : []
]

I have several "undefined" allocated in the slots.

Of course, the values are differents, this is a example.
I have 200+ constraints.
If I use just the arrays constraints, all works fine.

Any Idea?

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