[#47] getStartTimeMatrix& calculateEndTime

Migrated from Redmine #47 | Author: dave siracusa
Status: Closed | Priority: Normal | Created: 2017-09-27


I’m refactoring our pingup service logic.
I see calls to getStartTimeMatrix, and calls to: calculateEndTime.

The old logic appears to be making calls for each time time getStartTimeMatrix.
Our API is passed a range of date, a service id (treatment), and sometimes an employee id (personnel).
I wish to return availability for a given date range, basically starttime endtime for a date, given all available resources, or a specific one.

It seems to be too many calls? Given a treatment/service, and a duration for said service, can I make other calls.
Please advise.

Redmine Admin wrote:

you can use this function to get available time intervals for date range Company public service methods - Company public service methods - SimplyBook.me

dave siracusa wrote:

Can you please provide more information.
I’m currently making calls from java, an http post, with a JSON body.
@JsonProperty(“method”)
@JsonProperty(“jsonrpc”)
@JsonProperty(“id”)
@JsonProperty(“params”)

Redmine Admin wrote:

We are using JSON-RPC protocol JSON-RPC - Wikipedia

according to this it should be something like this

{“jsonrpc”:“2.0”,“id”:2,“method”:“getAvailableTimeIntervals”,“params”:[“2017-09-28”, “2017-09-30”, 3434, 4545, 1]}

dave siracusa wrote:

Is this call suitable for services? The current call, as mentioned above, is passed service and personnel?

dave siracusa wrote:

I made the call, I see the hours of operation:
{“result”:{“2017-09-28”:{“1”:[{“from”:“08:40:00”,“to”:“17:00:00”}]},“2017-09-29”:{“1”:[{“from”:“08:30:00”,“to”:“17:00:00”}]},“2017-09-30”:{“1”:[{“from”:“08:20:00”,“to”:“14:00:00”}]},“2017-10-01”:{“1”:},“2017-10-02”:{“1”:[{“from”:“08:40:00”,“to”:“16:50:00”}]},“2017-10-03”:{“1”:[{“from”:“08:40:00”,“to”:“17:00:00”}]},“2017-10-04”:{“1”:[{“from”:“08:40:00”,“to”:“16:50:00”}]},“2017-10-05”:{“1”:[{“from”:“08:40:00”,“to”:“17:00:00”}]}},“id”:“1”,“jsonrpc”:“2.0”}

Sorry if I wasn’t clear. I wish to display available booking times, and know the duration of the service.
As mentioned in the original post the legacy logic used getStartTimeMatrix, followed by calls to: calculateEndTime.
The calls to calculateEndTime for each start time appears excessive.