Skip to main content

Module import

Module import 

Source
Expand description

Importing an agent’s local history.

A team that adopts kasl-server late has employees who tracked their time locally for months. That history is in an ordinary SQLite file on their machine, and it should not be thrown away because the server arrived after it. This reads that file and writes the days into the server’s tables.

The awkward part is time. kasl stores bare wall-clock text - datetime(..., 'localtime'), no offset anywhere - which is unambiguous on the one machine that wrote it and meaningless to a server serving several time zones. There is nothing in the file to recover the offset from, so whoever runs the import states it, and the choice is theirs to make and to get wrong (ADR 0003, ADR 0006).

Structs§

AgentDay
One workday as it appears in the agent’s database.
AgentPause
AgentTask
ImportSummary
What an import did, for the operator to read back.

Functions§

at_offset
Applies the operator’s offset to a wall-clock time from the agent.
read_agent_db
Reads an agent’s database into days, newest last.
resolve_user
Finds the user an import writes for, refusing to invent one.
within
Keeps only the days within an inclusive date range.
write_days
Writes the days into the server’s tables, as the given user.