Coder Social home page Coder Social logo

node-sscheduler's Introduction

SSENSE

Source Code for SSense WebApplication

node-sscheduler's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-sscheduler's Issues

TypeError in NodeJS wth Express

how can i use it in my node js app
its gives me error "var myScheduler = new Scheduler();
^

TypeError: Scheduler is not a constructor
at Object. (E:\Hatook\TheDoctorApp\app.js:9:19)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:201:16)
at bootstrap_node.js:626:3"

Feature: Move TS compiler target from ES6 to ES5

The typescript is transpilled to ES6 which means that older browsers throw an error when they try to load it.

Would you be open to a pull request to change the TypeScript compiler target from ES6 to ES5?

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

There seem to be an issue when the from minute is between 1 & 4 (Example: 10:01 or 13:04)

<--- Last few GCs --->

[1565:0x103000000]   112575 ms: Mark-sweep 1303.7 (1398.3) -> 1303.4 (1398.3) MB, 930.6 / 0.0 ms  allocation failure GC in old space requested
[1565:0x103000000]   113567 ms: Mark-sweep 1303.4 (1398.3) -> 1303.3 (1336.3) MB, 991.7 / 0.0 ms  last resort GC in old space requested
[1565:0x103000000]   114504 ms: Mark-sweep 1303.3 (1336.3) -> 1303.3 (1332.3) MB, 936.7 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3e7ab63a5879 <JSObject>
    1: getAvailability [/Users/isanjayachar/mobilean/il9m/node-user/node_modules/@ssense/sscheduler/dist/Scheduler.js:~306] [pc=0x2553b7041b9a](this=0x3e7ae3a4ef19 <Scheduler map = 0x3e7a87d919d9>,p=0x3e7a5d009d09 <Object map = 0x3e7a87dd36c1>)
    2: /* anonymous */(aka /* anonymous */) [/Users/isanjayachar/mobilean/il9m/node-user/src/services/doctor/availability.service.js:128] [bytecode=0x3e7...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 4: v8::internal::Factory::NewUninitializedFixedArray(int) [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 5: v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 6: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/isanjayachar/.nvm/versions/node/v8.12.0/bin/node]
 7: 0x2553b6f042fd
{ 
  from: '2019-06-25',
  to: '2019-06-26',
  duration: 15,
  interval: 15,
  schedule:  {
     tuesday: { from: '00:01', to: '23:50' } 
  } 
}

Steps to reproduce

  1. Use the above object as param

Question: Is it possible to find complex slots for multiple people?

I'm working on a beauty salon app, that we can schedule some services.

Let's assume that the customer would like to schedule 4 services: haircut, manicure, pedicure and eyebrows. Each of these services can be a different professional or not. (let's imagine 3 professionals and 4 services in this case)

here are some rules:

I can cut my hair and do my nails at the same time.
I can NOT cut my hair and make eyebrows at the same time
I can NOT do manicure and pedicure at the same time IF both are with the same professional
for example:

haircuts and manicure from 11:00am to 11:40 am
eyebrow and pedicure from 11:40am to 12:20 pm

Some more problems, sometimes I may not have all the professionals available to do these sequential/parallel services straight, so if there is no straight slot available to schedule, then I must return the closest slot within a maximum wait of 20 min. Let's imagine there is no slot available to make it straight, the would be something like:

haircut from 11:00am to 11:40am
eyebrow and pedicure from 11:40am to 12:20pm
manicure from 12:35pm to 12:55pm (closest available slot is 15 min after the last one)

I can even pay for a help

Bug: scheduler.getAvailability returning incorrect values

Input value :

{ "from": "2020-03-16", "to": "2020-03-23", "duration": 45, "interval": 45, "schedule": { "friday": { "from": "09:00", "to": "11:00", "unavailability": [] }, "sunday": { "from": "09:00", "to": "14:00", "unavailability": [ { "from": "10:00", "to": "11:00" }, { "from": "12:00", "to": "13:00" } ] } } }

Output :

{ '2020-03-20': [ { time: '09:00', available: true, reference: null }, { time: '09:45', available: true, reference: null }, { time: '10:30', available: false, reference: null } ], '2020-03-22': [ { time: '09:00', available: true, reference: null }, { time: '09:45', available: false, reference: null }, { time: '10:30', available: false, reference: null }, { time: '11:15', available: true, reference: null }, { time: '12:00', available: false, reference: null }, { time: '12:45', available: false, reference: null }, { time: '13:30', available: false, reference: null } ] }

For sunday time slot is display incorrect

There has been close office between 10 to 11, So next opening stating from 11 instead of 11:15

Bug: scheduler.getAvailability returning incorrect values

Hi ๐Ÿ––
Thanks for sharing this great package!

I think I've spotted a bug and wanted to let you guys know. I'm using @ssense/[email protected] and have noticed that when I request availability where the duration approaches (or exceeds) the number of working hours in a schedule's day, then some incorrect time slots are marked as available.

For example, if I run

const availability = scheduler.getAvailability({
      from: '2017-02-01',
      to: '2017-02-02',
      duration: (60 * 8),
      interval: 60,
      schedule: {
        weekdays: {
          from: '09:00',
          to: '17:00',
          unavailability: [
          ],
        },
      },
    });

console.log('availability: ', availability);

The output is:

availability:  { '2017-02-01': 
[ { time: '09:00', available: true, reference: null },
{ time: '10:00', available: false, reference: null },
{ time: '11:00', available: false, reference: null },
{ time: '12:00', available: false, reference: null },
{ time: '13:00', available: false, reference: null },
{ time: '14:00', available: false, reference: null },
{ time: '15:00', available: false, reference: null },
{ time: '16:00', available: true, reference: null } ] }

I expect the 16:00 time to have the property available:false.

If I up the duration even further to 23 hours, then the availabilty object marks all the time slots as available but I'd expect them to all be false.

Thanks!

Schedule across several days?

Hi, scheduling in the same day works like a charm but I would like to schedule appointments that start on one day and finish in the next one. For example an hotel room that starts at 6pm trough the night until 11am next day, so in this case the duration would be 960. Is that possible?

Cut A New Release

Hi folks,

Thanks for this awesome library.

Any thoughts of cutting a new release? I want to use this in a yarn-based project, but if I install the latest commit on master, I see that only the source (and not the dist) is pulled into my node_modules folder.

P.S. I am new to the node / JavaScript ecosystem, but my understanding is that there should be a dist/index.js as described in this package's package.json.

Feature: Add Custom Schedule

First of all thanks for this great library.
Currently, the custom schedule depends on defining weekdays/weekday.
Is it possible to have this independent? Meaning just like the unavailability, allocated, can I specify an array of availability?

Thanks,
Chat.

Feature: expose method to check availability of multiple rooms

Hi,

Is it possible to to check availability of multiple rooms? in provided example, only one room can be checked.
Another thought, it would be nice to return room name in the availability object, would save lots of coding.
Thanks

 {
            weekdays: {
                from: '08:00', to: '20:00',
            },
            unavailability: [
                { from: '2017-02-06 00:00', to: '2017-02-16 00:00' }
            ]
        }

Documentation: Update docs to include reference key

Can you update documentation to include an example / use case?

{ time: '09:00', available: false, reference: null },
{ time: '09:30', available: false, reference: null },
{ time: '10:00', available: true, reference: null },
{ time: '10:30', available: true, reference: null },
{ time: '11:00', available: true, reference: null },

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.