1- Let’s say a teacher check in to school at 2/1/2023 , 7:00 am – and check out at 2/1/2023 , 2:00 pm
so he worked 8 hours , and he did this for a month , I want to sum all the hours he worked for the hole month , How ?
2- What’s the best data setup for this ?
what I did is created two field on User datatype :
1- Check-in-time - List of date
2- Check-out-time - List of date
Yes, the hours are saved, and if the user has worked 25 hours over the past two weeks and you change the constraint to sum the hours for the past two weeks, then yes, it will show 25 hours.
I am using the creation date of the shift because I assume shifts are created on the actual days when they occur. You could also use the time in or time out field to get the same result.
Hi again I hope you doing okay
I did your way and it’s work perfect thank for that , I just have one little problem , I want the check in/out - in one button like the image below
but how I can make it - when user is checked in today and click it again this time he will check out -
because if I make two button and the user could click the wrong button and also it’s look perfect in one button
You can create two workflow events (events, not actions within the same event) for that button. The first event will run an action to check the user in only when the count of a search for a shift for the user on the current day that doesn’t have an end time is 0. The second event will have a similar condition on it, but the count will be greater than 0, and the action within the event will check the user out.
Give this a go… create two workflow events (not custom events) like what I am showing below. The one I am showing will create a new shift for a user if they don’t already have a shift on the current day.
The workflow event on the left is the same, except the count in the condition is greater than 0, and the action inside the event will make changes to the current day’s existing shift instead of creating a new shift.
Make sense?
Edit: after looking back at my initial reply in this thread, the conditions I described above can be a lot simpler if you are using the current shift field on the User data type. If you are using that field, the condition I am showing can simply be Current User's current shift is empty. In that workflow, create a new shift, and in the next step, set the user’s current shift field to the result of step 1. Then, the condition on the other workflow would be Current user's current shift is not empty. That workflow will make changes to the Current user's current shift, and the change to make is to update the shift’s time out field with the current date/time. Finally, have a second step in that workflow that sets the current user’s current shift field to empty, and you should be good to go.
it’s works perfect , I appreciate your effort really , and actually I make it two button looks better , any problem never stop showing up , the problem is :
when Me As Parent check in two kids at 8:30 AM and then I came back and I checked out only one kid at 10 AM , and then came back and checked out the other one at 11 AM
in the data both will showing checked out at 11 AM
It depends on how you are identifying students in the app. Because a parent can be checking in or checking out more than one student, you have to somehow specify the student who is being checked in or out. Without knowing all of the details of your app, there is no way I can be more specific than that.
in the shift datatype I make it like this , so I can know who check in and who check out , and please if you can tell me what kind of data you want to know , I’ll be happy to share screenshot with you
I would get rid of the list fields and have a student field that links to the Students data type. When a shift is created (i.e., when a student is checked in), populate the student field with the related student’s thing in the Students data type. When a student is checked out, find the shift that is related to that student and populate the time-out field.
Oh, and given the additional information in your latest question, you can’t use the current shift concept that I described earlier in this thread.
but the problem if parent want to check in kid , he can’t check more than one kid in the same time , right ?
he has to do the same process numerous time depending on number of student they have
You can make a user interface that enables a parent to check in multiple kids at the same time, but no matter how you do it, you should create a separate thing in the Shift data type for each kid.