Create New Thing's

Hi,

Wonder if somebody could help me.

I am logging times of employees working. I want to then be able to query the data and then if certain conditions are met I want to log this as a infringement. I am basically looking at it and if certain hours are met ‘creating a new thing’. This is working on this one day. However, I want this to be able to look and analyse all the data in a week each time because, the maximum time in the week is going to change things. Ie. what they do on friday could cause a problem on Monday.

Any help would be brilliant :slight_smile:

Cheers,

Just thinking ways around this. I suppose on every shift I could create a infringement then have a yes/no for visible. Then make changes to a list of things. If the conditions are met make this infringement visible. Would this work? It does not feel very good solution.
Thanks

Building an employee hours system can be tricky at first. But my approach is to have the app based around

Here’s a four-table approach:

  • User table (ie. Employees): name, current Shift, all Shifts*
    *Shift: a list of Events for a given shift, User Associated, Aggregate Time, list of Rule Issues (may be zero, may be one, may be several)
  • Event: log time start, log time end, aggregate time, Hours Type, User Associated; list of Rule Issues (may be zero, may be one, may be several)
    Rule Issue: name, defined variables.

In some cases, you may have 1 event in 1 shift, but that’s not the likely case. You want to be able to aggregate both across Shifts and across individual events.

With the workflow you use for clock out, you use the rule issue table to run based on:

  1. Event
  2. End of Shift
  3. To scan across the past n days (for aggregate hours) or based on a date range

This would add the relevant list of Rules Issues (if any) to the Shift and/or Event

Cheers @dan1 much appreciated.

This is the rule I am trying to query:-
‘In any working day the maximum amount of duty permitted is 11 hours. A driver is exempt from the daily duty limit (11 hours) on any working day when they do not drive.
A driver who does not drive for more than 4 hours on each day of the week is exempt from the daily duty limit for the whole week.
Week: Is the period from 0000 hrs on a Monday to 2400 hrs the following Sunday.’

I am still unsure how to get this to work. If I have the infringements built into each day with a yes/no etc… I can get it to work by ‘modifying a list of things’. However, to do this by creating a new table of infringements I can’t figure out how to say check all days in the given week and make infringements based of this.

Cheers Again :slight_smile:

Fun problem. Some additional thoughts below. May not solve it, but perhaps it’ll spark an idea.

If using my model as a base, it may be worth re-working the concept to add a “Day” table instead of just a Session table. (Because Shifts can cross Day boundaries). For each Day record, place a boolean flag that defaults to “No”. Then, if the hours limit is crossed, change to Yes.

Create a Day record for every employee for every day, regardless of if they worked. (You can have these generated by some process like a recurring event or seed their user account when created).

Given that, you can query for any employee that has more than n values as Yes or No within a given time period and flag it. (Do a Search based on the trailing number of days and count the number of Yes/No values).

1 Like

Thanks again @dan1.

I’m stuck in 2 minds whether to scrap the infringements table and just highlight any infringements in the “day” table ie. yes/ no for infringement.

Second option I can think of is to create a “duty infringement” in the “infringement” regardless if it’s there or not. Then in this I can then have a yes/no to see if it’s true by using modify a list of things. Then maybe once a date has been added say a week past the week in question delete the infringements (using delete list of things) that are not true (to keep it a bit cleaner).

There is probably 4 different types of infringements that can happen in a day. Is there any reason one of these wouldn’t work or which give better performance?

Cheers

This topic was automatically closed after 70 days. New replies are no longer allowed.