From a728a6054e5f2efd35592de7ad45b457da554008 Mon Sep 17 00:00:00 2001 From: CJ Wong Date: Wed, 29 Apr 2020 16:17:25 -0700 Subject: [PATCH] Update docs --- CHANGELOG.md | 34 ++++++++++++++++++++++++++-------- NOTICE | 4 ++-- README.md | 4 +++- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 641f3db..196315f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,36 +3,54 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [1.2.0] - 2020-04-29 UNRELEASED +### Changed +- The project has been renamed to *Caltab* for brevity: a tab (spreadsheet) with calendar entries' durations. +- Renamed `process.py` to [main.py](main.py). +- Moved all module-level code in [main.py](main.py) into separate function `main()`. +- Moved all *Google API* related modules into new directory [google](google). +- Changed return value of `api_handler.authorize()` to the credentials. +- Improved README; rewrote to clarify vocabulary and detailed steps for setup. +- [Configuration](config.yaml.example) has been simplified; to maintain separation, neither calendars nor sheets/tabs are nested in the other. Now, it's possible for two calendars to have the same event/sheet to track. +- In the [API handler](google/api_handler.py), `ExpiredCredentialsError` is now `ExpiredCredentials` and subclasses `RuntimeError` instead of an extraneous custom `Error`. +- In [google.calendar](google/calendar.py): + - `Calendar.get_entries()` had its arguments reversed to match the dictionary's structure (`{calendar name: calendar id}`). + - `get_tab()` no longer needs the second argument as `config.TABS` now contains the names and aliases. Furthermore, instead of returning `None`, the function either returns a string (matched tab name) or raises `TabNotFound` - handled with a try-except in `Calendar.get_entries()`. +- In [google.sheets](google/sheets.py): + - `col_to_day()` and `day_to_col()` combined to form `get_yesterday_cell()`. + - `Sheets.get_ids()` was removed, as it wasn't used. + - Moved some functionality of `Sheets.input_hours()` into `Sheets.get_tab_cells()` to refactor. `Sheets.input_hours()` calls the new function to make up for lost functionality. + ## [1.1.3] - 2019-12-25 ### Changed - Use `RotatingFileHandler` for logs ## [1.1.2] - 2019-11-20 ### Changed -- Changed `len(update)` to more sensible `update['updatedCells']` in [`gsheets.py`](gsheets.py) +- Changed `len(update)` to more sensible `update['updatedCells']` in `gsheets.py` ### Fixed -- Fixed issue with missing `YESTERDAY` reference in [`gsheets.py`](gsheets.py) +- Fixed issue with missing `YESTERDAY` reference in `gsheets.py` ## [1.1.1] - 2019-11-05 ### Changed - Change stream logger error level to `INFO` ### Fixed -- Use `name` instead of `entry` when checking aliases in [`gcalendar.py`](gcalendar.py) +- Use `name` instead of `entry` when checking aliases in `gcalendar.py` -## [1.1] - 2019-10-12 +## [1.1.0] - 2019-10-12 ### Added - [`config.py`](config.py) handles configuration shared between all the modules. -- [`api_handler.py`](api_handler.py) handles the *Google API* credentials and directly calls [`gcalendar.py`](gcalendar.py) & [`gsheets.py`](gsheets.py) -- [`gcalendar.py`](gcalendar.py) & [`gsheets.py`](gsheets.py) handle their respective *Google API* modules. +- `api_handler.py` handles the *Google API* credentials and directly calls `gcalendar.py` & `gsheets.py` +- `gcalendar.py` & `gsheets.py` handle their respective *Google API* modules. ### Changed -- [`process.py`](process.py) was broken into the three new modules, for modularity. +- `process.py` was broken into the three new modules, for modularity. - Furthermore, the Apache License *Google LLC*-licensed code was moved to [`config.py`](config.py) - Instead of calling `sys.exit`, a new exception `api_handler.ExpiredCredentialsError` is raised. - Several functions were simplified in name, because `gsheets.Sheets.get_sheet_ids` is redundant compared to `gsheets.Sheets.get_ids`. -## [1.0] - 2019-09-26 +## [1.0.0] - 2019-09-26 ### Added - Initial version diff --git a/NOTICE b/NOTICE index 8715fc0..e4c63c5 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ -Calendar-to-Sheets -Copyright 2019 cj-wong +Caltab +Copyright 2019-2020 cj-wong G Suite Python Samples Copyright 2018 Google LLC diff --git a/README.md b/README.md index 8965ca4..d2b3a1d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Want to record event duration from your *[Google Calendar][GCAL]* calendar into a *[Google Sheets][GSHEETS]* spreadsheet? This project has you covered: it automates the process for you! Each tracked event can be recorded into a spreadsheet containing a sheet with the same name. Aliases can be added per event as necessary. +Although you can run the project manually, I highly recommend using an automation system like `cron` and running once a day at a specific time. + ## Requirements This code is designed around the following: @@ -62,7 +64,7 @@ Each event in the configuration must belong only to one calendar and must only b 3. For each sheet/tab you plan to use with calendar tracking, copy the template starting with the name up til `month:`. Follow the below instructions. - List each tab under `tabs:` with aliases and other attributes. **Note that each tabs must correspond to the `tabs:` under at least one calendar entry in `calendars:`.** - - Record the starting cell (top-left cell) location into `cell:` under `start:`. In the example below, it's `cell: B2`. + - Record the starting cell (top-left cell) location into `cell:` under `start:`. In the example below, it's `cell: B2`. **This column value (e.g. the *B* in *B2*) cannot be *AA* or beyond.** - Also under `start:`, record which year (`year:`) and month (`month:`) that row corresponds to the cell. In the example below, it's `year: 2019` and `month: 1`. ### Sheets Structure