Source Code for SSense WebApplication
ssense / node-sscheduler Goto Github PK
View Code? Open in Web Editor NEWResource Scheduling Engine
License: MIT License
Resource Scheduling Engine
License: MIT License
While the library seems very usefull, this is not able to fetch future dates when i pass the to date it returns with a blank object
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"
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?
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
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
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
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!
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?
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
.
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.
This is not an issue just a question.
Can this be used as an appointment setter with time slots?
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' }
]
}
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 },
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.