|Version 1 (modified by tst, 10 years ago) (diff)|
TracSlimTimerPlugin Reporting Module
The purpose of the reporting module is two-fold:
- To create a backup of SlimTimer records in the event that SlimTimer is unavailable.
- To provide a unified repository of a team's time recording for reporting purposes.
The database schema is as follows:
This schema is NOT automatically created by the reporting module. It must be manually setup. The SQL code required for doing this is timetracking.sql.
You will also need to set up an appropriate user(s) for accessing the database.
The basic process is as follows:
- Get configuration options, log file, etc.
- For each user who is enabled for reporting (as defined in the trac screen Admin → SlimTimerIntegration → Users):
- Delete all records from the database in the specified date range for this user
- Fetch all time entries for this user in the current date range
- For each entry
- Update/Insert the corresponding task in the tasks table
- Update the estimated hours for the task in the database from trac
- Update the hours worked in trac from the SlimTimer data
- Insert each time entry into the times table
Most of the configuration is performed through the Reporting admin panel:
A log file is appended whenever the dump is run. The location of this file can be set using the trac 'Reporting' administration panel, for example /var/trac/0.10.3/log/time_report.log.
The dump_users.py script has been created to support executing the dumping process from outside of trac. This script takes several parameters such as the base directory of the trac installation and the date range to dump. For information just run ./dump_users.py and you should get a usage screen showing the options.
The dump may be set to run periodically, for example, every night. This could be done using a cron job. For example, to have it run every night at 03:15 with a two week window we might use something like:
15 3 * * * /path/to/TracSlimTimer/tracslimtimer/dump_users.py --tracbase=/var/trac/0.10.3/var/trac --days=14