Documentation ¶
Overview ¶
Holidaybalance computes and updates employees vacation balance on google calendar.
USAGE
go install github.com/lvdlvd/holidaybalance # obtain a client_secret.json as per https://developers.google.com/google-apps/calendar/quickstart/go holidaybalance [-n] user@yourdomain.ai The -n flag supresses the updating of calendar entries. The program iterates over the listed calendar for whole-day entries with summary (title) containing the words "employee start date" and "{vacation|holiday} [half day]". The program will query the public holiday calendar for Switzerland/Zürich. It caches a local copy. Then it computes for each day the accrued and used holidays for that employee. Vacation days accrue at a rate of 25 days per 365 days, that is one for every 14.6 calendar days. 2020-02-29 will be declared an extra public holiday. We'll see about 2024. The descriptions of all "vacation" entries in the entire history will then be updated with a final line Vacation from ...to... accrued/used/balance per the end date. The program enforces no policies about allowed ranges of the balance, it is merely a tool to keep an eye on them.
PART TIME EMPLOYEES
The employee start date entry can have an optional description containing 'xxx %' to set a percentage different from 100% (full time). These entries may occur multiple times to change the FTE% over time. When booking a vacation in a period with the FTE<100%, vacations with a span of more than FTE% times a work week are counted as FTE days, not full days. That is, if you work e.g 60%, normally 3 days/week and you book 1, 2 or 3 calendar days, they are counted as 1,2 or 3 days but if you book a 4 day or longer period, they are counted as 60% of those in /working/ days (that is, after discounting public holidays). The intention is that part-time employees can also just book 2 weeks of holiday. If the results are wrong, book individual days instead. The minimum granularity of a holiday you can take is half a day, which is discouraged anyway. This facility is only so that people who work 2 mornings/week (20%) can take a day off.
SECURITY AND LOGIN
In addition to this binary, you need the file client_secret.json in the same directory. This provides access to the Google API's on behalf of the organisation. See https://developers.google.com/google-apps/calendar/quickstart/go on how to go about that. The first time the program is run by a user it will prompt with a URL to get user calendar modification credentials. Use the calendar's owner account for those. They are stored in ~/.credentials/holidaybalance.json If you have write access to other people's calendar you can update it for them. They may not like that.
KNOWN BUGS
Partial public holidays are counted as full days. The program can not force people to take holidays or to properly record them. If the public holiday calendar ever garbage-collects old entries, history will change.
Click to show internal directories.
Click to hide internal directories.