Contents
Team calendar
Description
This plugin adds a new navigation tab, "Team calendar", that can be used to keep track of team availability in a project. The data is stored in the database, which means it can be used in reports and queries.
See also: GoogleCalendarPlugin, GanttCalendarPlugin, CalendarPlugin
Bugs/Feature Requests
Existing bugs and feature requests for TeamCalendarPlugin are here.
If you have any issues, create a new ticket.
Download
Download the zipped source from here.
Source
You can check out TeamCalendarPlugin from here using Subversion, or browse the source with Trac.
Prerequisites
Note that the plugin is currently tied to MySQL. Updates to make it more database agnostic would be welcome. See #4243 - MySQL Testers needed''
Installation
Create table in database: (this is MySQL, sqlite version appreciated)
CREATE TABLE `team_availability` ( `username` varchar(255) NOT NULL DEFAULT '', `ondate` date NOT NULL DEFAULT '0000-00-00', `availability` float unsigned DEFAULT NULL, PRIMARY KEY (`username`,`ondate`) );
For PostgreSQL 8.3, we created the table with:
CREATE TABLE team_availability ( username varchar(255) NOT NULL DEFAULT '', ondate date NOT NULL, availability float DEFAULT NULL, PRIMARY KEY (username,ondate) );
For Sqlite3:
sqlite3 trac.db
CREATE TABLE team_availability ( username text not null default '', ondate date not null default (datetime('now')), availability float default null, PRIMARY KEY (username,ondate) );
Under the hood
This plugin adds a new tab, Team Calendar, to users with the TEAMCALENDAR_VIEW permission. This shows a simple tables with dates running down the rows and team members across the columns. Users with TEAMCALENDAR_UPDATE_OWN permissions can change the state of the tick boxes under their own name, and save the results. Users with TEAMCALENDAR_UPDATE_OTHERS permission can update everyone's.
The table is populated form the team_availability table in the database.
The 'availability' column will contain 0 or 1 if populated through the GUI. It is left as a float to make it possible to store more granular availability, e.g. half-day, but there is no UI for this at present.
The calendar does not do anything more by itself. However, the team_availability table can be used in reports.
Recent Changes
[11207] by ChrisNelson on 01/27/12 20:00:26
Allow configuration of normal work week. Refs #9735.
The original plugin assumed if there was no data in the database, that no one was working.
With this change, that is still the default, but you can configure work_days in the team-calendar section of trac.ini to a list of week days that people usually work and that will be used if no data is in the database. 0 is Monday so 0,1,2,3,4 is a "normal" Monday-Friday week with Saturday and Sunday off.
[11206] by ChrisNelson on 01/27/12 20:00:21
Finish conversion to Trac DP API. Refs #4243, #7115.
[11199] by ChrisNelson on 01/26/12 22:07:37
Make initial load db-agnostic. Refs #4243, #7115.
Following up on
http://groups.google.com/group/trac-dev/browse_thread/thread/ba5cf0d9276ba872?hl=en&tvc=2
which points to
http://trac.edgewall.org/wiki/TracDev/DatabaseApi#RulesforDBAPIUsage
use the Trac DB API better to make this code database-agnostic.
[11189] by ChrisNelson on 01/24/12 16:38:42
An alternative, db-agnostic fix for updating availability. Refs #4243, 7115.
This approach assumes it is faster to manipulate Python lists in memory and minimize DB access than to do at least one DB access per record.
The patch in 4243 did one SELECT to get the state of the DB, then one UPDATE or INSERT for each and every record.
The patch in 7115 did something similar less elegantly.
This version does one SELECT, some list manipulation, one UPDATE for each *changed* record, one INSERT for *all* *new* records, and nothing for records that didn't change.
Author/Contributors
Author: optilude
Maintainer: ChrisNelson
Contributors:

