Skip to content

Unlinked people

Say someone is enrolled at a clock before anyone has told the sender their employee id. They still punch, and none of that time is lost. Time and Attendance keeps them as an unlinked person. It calculates their hours with the tenant’s rules. It moves their punches to the right employee once someone says who they are.

Connect enrolls a person at a clock and sends their punches at once. Until the person has an employee id among their external ids, those punches carry no person_id. Time and Attendance keeps them for an unlinked person of the tenant that received them. The person is known by the sender’s ids. These are the Connect tenant, the person’s sync group and Connect’s id of them (hq~0c6f2a1e-..., or acme.hq~0c6f2a1e-... for Connect tenant acme; see whose punch it is).

These are kept with them: the endpoint, the user’s id on the device, the device they last punched at, and when they were first and last seen.

An unlinked person is calculated like anyone else, with the tenant’s rules. They have no setup or employment history of their own. A manager can still see their hours (GET .../people/{id}/ledger) and their exceptions.

The event person.unlinked_seen is sent once, when an unlinked person is first calculated, with the sender’s ids.

To treat unlinked people differently, give a policy layer the eligibility rule unlinked = true. The cookbook’s unlinked people recipe uses one to raise an exception on each of their days, asking someone to say who they are.

APIhourctl
ListGET /api/attendance/tenants/{tenant}/unlinked?linked=falsehourctl -t acme attend unlinked list --linked false
ReadGET .../unlinked/{id}hourctl -t acme attend unlinked show hq~0c6f2a1e
LinkPOST .../unlinked/{id}/link with {"person": "4471"}hourctl -t acme attend unlinked link hq~0c6f2a1e 4471
UnlinkPOST .../unlinked/{id}/link with {"person": null}hourctl -t acme attend unlinked unlink hq~0c6f2a1e

The exceptions list (GET .../exceptions?unlinked=true) and the pending list (GET .../pending?unlinked=true) mark unlinked people ("unlinked": true). They can also filter on it, with false for everyone else. under= on the unlinked list filters by the person each is linked to (lists of those under an organization).

Linking says who the unlinked person is, such as “this is employee 4471”. A link is kept like any fact. It is stamped with when it was stored.

From that instant, the unlinked person’s punches are 4471’s. So are the corrections made to them. So are the punches that arrive under the sender’s ids afterward, until the sender learns the employee id. Nothing before the link is rewritten. Each period keeps the punches it had at the time.

Unlinked hq~0c6f2a1e punches since Monday link to 4471 stored Thu 10:00 Employee 4471 those punches, and later ones Open period recalculated from the earliest punch that moved Closed period a late change: an adjustment, or refused, as its rules say
The link takes effect at the instant it is stored. Periods still open are recalculated. A period already closed treats the moved punches like any punch stored after its close.

In practice:

  • 4471’s ledgers are recalculated from the earliest punch that moved. The unlinked person’s ledgers are recalculated as well. They lose those punches.
  • A closed period of 4471’s takes the punches as a late change, like any punch stored after its close. The result is an adjustment in the period open at the link, or the change is refused, as its rules say.
  • Linking to someone else, or unlinking, works the same way. The punches move from the new link on. Linking to the person they are already linked to changes nothing. Linking to another unlinked person is refused (400).

Each link sends person.linked. It carries the unlinked person’s id, the person they are linked to (null when unlinked), the person before, and the sender’s ids.

A sink of the tenant’s events can carry the link back to the sender. In Connect, set the person’s employee id through its API. That links them there and sends them to every clock in their group. Their punches carry the id as person_id from then on.

A tenant’s written-out document carries its unlinked people and their links, each with when it was stored. Loaded elsewhere, the punches are where they were.