A comprehensive OpenProject plugin that extends the built-in time tracking feature to allow setting weekly quotas for each user and calculating and displaying total overtime based on the difference between the quota and actual tracked time.
- Weekly Quota Management: Set individual weekly working hour quotas for each user
- Start Date Configuration: Define when overtime calculation should begin for each user
- Automatic Overtime Calculation: Calculate overtime automatically based on tracked time vs. quota
- Admin Interface: Comprehensive admin panel to manage user quotas
- User Dashboard: Dedicated page for users to view their overtime statistics
- Weekly Breakdown: Detailed week-by-week view of hours worked and overtime
- CSV Export: Export overtime data to CSV format for further analysis
- Multi-language Support: Includes English and German translations
- OpenProject 13.x or later (tested with latest version)
- Ruby on Rails 7.0+
- PostgreSQL or MySQL database
- Clone or copy this plugin into your OpenProject plugins directory:
cd /path/to/openproject
mkdir -p plugins
cd plugins
git clone <this-repository> openproject-overtime- Add the plugin to your
Gemfile.plugins:
gem "openproject-overtime", path: "plugins/openproject-overtime"- Install dependencies and run migrations:
bundle install
bundle exec rake db:migrate- Restart your OpenProject instance:
# For development
bundle exec rails server
# For production (passenger/systemd)
sudo systemctl restart openproject- Copy the plugin to your OpenProject installation:
# For packaged installation
sudo cp -r openproject-overtime /opt/openproject/vendor/bundle/ruby/*/bundler/gems/- Add to
Gemfile.pluginsin your OpenProject directory:
gem "openproject-overtime", path: "/path/to/openproject-overtime"- Run migrations:
cd /opt/openproject
sudo openproject run bundle exec rake db:migrate- Restart OpenProject:
sudo systemctl restart openproject- Log in as an administrator
- Navigate to Administration → Overtime Settings
- Click New Quota to create a quota for a user
- Fill in the form:
- User: Select the user
- Weekly Hours Quota: Enter expected weekly hours (e.g., 40)
- Start Date: Choose when tracking should begin
- Active: Check to activate the quota
- Click Save
From the Overtime Settings page, you can:
- View all configured quotas
- See real-time overtime calculations
- Edit existing quotas
- Delete quotas
- View all users and their quota status
- Click on your avatar in the top right
- Select My Overtime from the account menu
- View your overtime statistics:
- Weekly quota
- Start date
- Total weeks tracked
- Average weekly hours
- Total overtime (highlighted in red if positive, green if negative)
- Weekly breakdown table
Users can export their overtime data:
- Go to My Overtime
- Click Export to CSV
- The CSV file includes:
- Week-by-week breakdown
- Total hours per week
- Quota
- Overtime per week
- Total overtime summary
The plugin calculates overtime using the following logic:
- Weekly Basis: Time entries are grouped by week (Monday to Sunday)
- Quota Comparison: For each week, total hours are compared against the weekly quota
- Overtime Calculation:
- Overtime = Total Hours - Weekly Quota
- Positive values indicate extra hours worked
- Negative values indicate hours under quota
- Total Overtime: Sum of all weekly overtime since the start date
User quota: 40 hours/week, Start date: January 1, 2025
| Week Starting | Hours Worked | Quota | Overtime |
|---|---|---|---|
| Jan 1, 2025 | 45.0 | 40.0 | +5.0 |
| Jan 8, 2025 | 38.5 | 40.0 | -1.5 |
| Jan 15, 2025 | 42.0 | 40.0 | +2.0 |
| Total | 125.5 | 120.0 | +5.5 |
The plugin adds one main table:
| Column | Type | Description |
|---|---|---|
| id | integer | Primary key |
| user_id | integer | Foreign key to users table |
| weekly_hours_quota | decimal | Weekly working hours quota |
| start_date | date | When tracking begins |
| active | boolean | Whether quota is active |
| created_at | datetime | Record creation timestamp |
| updated_at | datetime | Record update timestamp |
Main service for calculating overtime:
# Calculate for a specific user
result = OvertimeCalculationService.calculate_for_user(user)
# Calculate for all users
results = OvertimeCalculationService.calculate_for_all_users# Get current quota for a user
quota = UserOvertimeQuota.current_for_user(user)
# Calculate total overtime
total = quota.total_overtime
# Get detailed summary
summary = quota.overtime_summarybundle exec rake specopenproject-overtime/
├── app/
│ ├── controllers/
│ │ └── overtime/
│ │ ├── admin_controller.rb
│ │ └── user_overtime_controller.rb
│ ├── models/
│ │ └── user_overtime_quota.rb
│ ├── services/
│ │ └── overtime_calculation_service.rb
│ └── views/
│ └── overtime/
│ ├── admin/
│ └── user_overtime/
├── config/
│ ├── locales/
│ │ ├── en.yml
│ │ └── de.yml
│ └── routes.rb
├── db/
│ └── migrate/
│ └── 001_create_user_overtime_quotas.rb
├── lib/
│ ├── openproject-overtime.rb
│ └── openproject/
│ └── overtime/
│ ├── engine.rb
│ └── hooks.rb
├── openproject-overtime.gemspec
└── README.md
- Ensure migrations have run:
bundle exec rake db:migrate - Restart the OpenProject server
- Clear browser cache
- Check that you're logged in as an admin (for admin menu)
- Verify the start date is correct
- Check that time entries have the correct
spent_ondates - Ensure weekly quota is set correctly
- Remember: weeks start on Monday
The plugin requires:
- Admin permissions to access Overtime Settings
- Users must be logged in to view their overtime
GPLv3 - See OpenProject licensing
For issues and feature requests, please use the GitHub issue tracker.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Initial release
- Weekly quota management
- Overtime calculation
- Admin interface
- User dashboard
- CSV export
- English and German translations
Future enhancements may include:
- Monthly and yearly overtime views
- Overtime approval workflow
- Email notifications for excessive overtime
- Integration with holiday/absence tracking
- Customizable overtime policies (e.g., different quotas per day)
- REST API endpoints
- Dashboard widgets
- Graphical charts and visualizations
Developed for OpenProject community