Automatic processes that affect work duration

Auto stop process

Makes sure that works left running do not last too long or forever. This is needed, for example, when the phone is out of coverage and the actual end of the work does not reach the system, or when the phone’s battery has run out and the work in progress cannot be finished.

The auto stop process runs every 4 hours at 22 minutes past the hour (00:22, 04:22, 08:22 and so on). It finds all works that were started more than 24 hours ago and have not been finished or deleted. Between two runs, “Realtime info” may temporarily show works lasting up to 28 hours.

Each work left running is finished according to these rules:

  1. If the work was started from a schedule, the work’s duration is set to its duration in the schedule.
  2. If the work was not started from a schedule, but the company has norm hours and overtime set (“Company settings”, tab “Working day settings”), the work’s duration is set to the sum of the norm hours and overtime.
  3. If the company has no norm hours or overtime set, the work’s duration is set to 24 hours, because nobody can be at work for more than 24 hours at a time.

“Automatically stopped” (auto_stop) is added to the work’s log.

If the phone comes back into coverage and the system learns the actual end of the work, the end time from the phone is used. If that makes the work longer than 28 hours, the work duration limit process applies (see below).

If a work has been finished automatically but the phone then reports that the work is still going on, the automatic end time is removed from the work and “Undo automatic stop” (restart) is added to the work’s log. This does not prevent the auto stop process or the work duration limit process from changing the same work again later.

Work duration limit process

If the phone reports an end time that makes the work longer than 28 hours (for example 30 hours), the system finishes the work at 24 hours. A duration of up to 28 hours is kept. In this case the auto stop rules that use the schedule’s duration or the working day settings are not applied. The system adds the note “Terake.api” “Limited duration automatically” (auto_limit_duration) to the work’s log. The actual end time received from the phone is added to the log details (which are not visible to the user).

This process does not apply to works whose work name has “Excluded from worktime” ticked in its settings.

The process works in real time.

Duplicate work limit process

Makes sure that works started from the mobile app are not duplicated. Duplicate running works happen because of a bug in the old version of the Terake Workfields app (users should use Terake Worker, in as new a version as possible). This can also happen, for example, when a worker uses two devices, one of which has poor coverage and therefore synchronises data poorly.

The process finds overlapping works that were both started from the mobile app and sets the end time of the earlier work to the start time of the later work. The process does not apply to works that were not started from the mobile app.

So that the work duration can be synchronised from the phone in the normal way, for example from a phone that was out of coverage for a while or whose battery was empty, the system waits 8 hours for the actual end time of the earlier work to arrive from the phone before the automatic duplicate work limit applies. Because of this, “Realtime info” may temporarily show duplicate works overlapping by up to 8 hours.

“Automatically stopped” (auto_stop) is added to the log of the work finished automatically.