Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Calculate vacant shift total WordPress

  • SOLVED

I have a custom post type created when people checkin for their shift.

post_type_name = checkin

At the end of each month it would be great to know how much time was not covered by shifts. i.e. vacant,

So the idea would be that if a bunch of people didn't checkin or checked in late. I would get a total of hours eg: 12 hours that nobody was actually checked-in. I assume we can calculate late checkins when I compare 'post_date' to my meta 'start_unix' that will show if they checkin late. But I'm not sure how I would know if a person never checked in at all. Unless I compare last post to next post to see if it ended the same time another started.

This is the meta data I collect when they checkin and select their shift. My feeling was I would use the time the post was created vs


[start] => Array
(
[0] => Tuesday 06:00 PM
)

[start_unix] => Array
(
[0] => 1528840800
)

[end] => Array
(
[0] => Tuesday 10:00 PM
)

[end_unix] => Array
(
[0] => 1528855200
)

Answers (3)

2018-06-13

Arnav Joy answers:

how you are gathering check in time ?
and what about check out time ?

so if am correct check in time will be same for all day say 9 am in the morning and if any body check ins at 12 pm so we have 3 hrs vacant shift for the day and this will added to all other vacant shifts ??
please explain .


User179751 comments:

I don't get checkout time, I only have them enter shift when they arrive, They would select start and end time. Sometimes shift would overlap from one day to next, eg: 11pm to 6am type thing,


Arnav Joy comments:

do you have site you can show me ??
can you add me on skype or gmail ?

gmail : [email protected]
skype : arnav.joy


User179751 comments:

nothing to see just two time widgets that work together, they select start and end time click checkin.


Arnav Joy comments:

sorry not getting what do you mean by two time ?
start and end time checkin ???


User179751 comments:

on the front end all you see it two time selection widgets that let you select start and end time. The important part is I want to run a query that will tell me how much time in hours nobody checked into a shift.

2018-06-15

Mohamed Ahmed answers:

You mean the normal case is 8 hours long and some are 4 hours?

2018-06-14

Reigel Gallarde answers:

Do they select start and end time at the same time?


User179751 comments:

yes thats correct,


Reigel Gallarde comments:

are the start time and end time has a fixed value?


User179751 comments:

no, shifts are rather fluid. But they are typically 8 hours long and some are 4.