wiki:TracSlimTimerPluginReportingModule

Version 1 (modified by tst, 7 years ago) (diff)

Initial version

TracSlimTimerPlugin Reporting Module

The purpose of the reporting module is two-fold:

  1. To create a backup of SlimTimer records in the event that SlimTimer is unavailable.
  2. To provide a unified repository of a team's time recording for reporting purposes.

Schema

The database schema is as follows:

source:tracslimtimerplugin/docs/images/timetracking-schema.png

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.

Operation

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

Configuration

Most of the configuration is performed through the Reporting admin panel:

source:tracslimtimerplugin/docs/images/reporting-full.png

However, as noted in the developers guide it may be necessary to change the first line of dump_users.py so that it corresponds to the trac version of Python.

Logs

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.

Cron job

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