Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 19, 2025

This PR implements the feature request described in issue #219 to enable per-task time tracking with planned vs actual time comparisons and API endpoints for creating predefined tasks. The implementation includes proper global setting integration and conditional UI display throughout the application, now enhanced with comprehensive project performance analytics.

Key Features

Enhanced Task Schema

  • Added estimatedHours field to task creation and update methods
  • Field is optional and backward-compatible with existing tasks
  • Supports decimal values for precise time estimation

Global Setting Control

  • Added enableTaskPlanning global setting to control feature activation
  • Setting is disabled by default to ensure backward compatibility
  • Located in the time tracking category of administration settings
  • Controls visibility of task planning UI across all components

Comprehensive UI Integration with Performance Analytics

  • Task Modal: Estimated hours field integrated into BlazeJS task modal template with conditional display
  • Enhanced Project Tasks Table: Now includes comprehensive performance tracking with:
    • Estimated Hours: Shows planned time allocation per task
    • Actual Hours: Displays total tracked time from timecard entries
    • Variance Analysis: Color-coded difference between actual and estimated hours
      • Green: Under budget (negative variance)
      • Red: Over budget (positive variance)
    • Progress Visualization: Bootstrap progress bars showing completion percentage
      • Green: On track (≤100%)
      • Yellow: Slightly over (100-110%)
      • Red: Significantly over (>110%)
  • Reactive Updates: All UI components update automatically when setting is changed
  • Proper Form Handling: Number input validation and consistent styling

API Endpoints

POST /project/task/create - Create predefined tasks with estimated hours:

{
  "projectId": "abc123",
  "name": "UI Development",
  "start": "2024-01-01T09:00:00.000Z",
  "end": "2024-01-05T17:00:00.000Z", 
  "estimatedHours": 40
}

GET /project/tasks/:projectId - List all predefined tasks for a project

GET /project/task/stats/:projectId - Get comprehensive planned vs actual statistics:

{
  "totalEstimatedHours": 120,
  "totalActualHours": 135,
  "tasks": [
    {
      "taskName": "UI Development",
      "estimatedHours": 40,
      "actualHours": 45,
      "variance": 5
    }
  ]
}

Business Value

  • Controlled Rollout: Global setting allows administrators to enable the feature when ready
  • Complete Project Visibility: Comprehensive view of planned vs actual performance across all tasks
  • Real-time Performance Monitoring: Visual indicators for project health and budget compliance
  • Billing Analysis: Compare planned vs actual hours with variance calculation for accurate billing
  • Project Planning: Use historical data to improve future estimates
  • Performance Tracking: Monitor task and project delivery efficiency with instant visual feedback
  • Budget Management: Immediate identification of over/under budget tasks through color-coded indicators
  • External Integration: RESTful API enables easy integration with other project management tools

Implementation Details

  • Backward Compatibility: Feature is disabled by default and doesn't affect existing workflows
  • Security: All endpoints require authentication and validate project access
  • Performance: Uses MongoDB aggregation for efficient statistics calculation and optimized timecard subscriptions
  • Error Handling: Comprehensive validation and informative error responses
  • Internationalization: Complete translation support for UI elements in all supported languages (English, German, Spanish, French, Russian, Ukrainian, Chinese)
  • Reactive UI: All templates update automatically when global setting changes
  • Visual Design: Bootstrap-based progress bars and color-coded variance indicators for intuitive project monitoring

Enhanced Task Table with Performance Analytics

The enhanced project tasks table provides immediate visual feedback on project performance, making it easy to identify over/under budget tasks and track progress toward completion. The variance calculation and progress visualization enable the "detailed analysis of where insufficient time was allocated" and make "final billing very feasible" as requested in the original issue.

Fixes #219


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] implement the feature request described in issue #219 Implement per-task time tracking and predefined tasks API for improved billing analysis Aug 19, 2025
Copilot AI requested a review from faburem August 19, 2025 18:03
Copy link
Collaborator

@faburem faburem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

  • It is anticipated that a new global setting will be implemented to activate this feature, mirroring the functionality of existing features.
  • The new estimated hours field was not incorporated into the BlazeJS (Handlebars) template; this field should be displayed contingent upon the aforementioned global setting.

@faburem
Copy link
Collaborator

faburem commented Aug 19, 2025

@copilot check my previous comment

Copy link
Contributor Author

Copilot AI commented Aug 19, 2025

@copilot

  • It is anticipated that a new global setting will be implemented to activate this feature, mirroring the functionality of existing features.
  • The new estimated hours field was not incorp...

I've implemented both requested features:

  1. Added global setting: enableTaskPlanning setting in the time tracking category that controls the feature activation
  2. Added estimated hours field: The field is now included in the task modal template and only displays when the global setting is enabled

Key changes in commit 8480d92:

  • New global setting enableTaskPlanning (checkbox, default false)
  • Estimated hours input field in taskModal.html with conditional display
  • Updated taskModal.js with helper functions and global settings subscription
  • Added translation keys for both the setting and field

The estimated hours field will only appear in the task creation/edit modal when an administrator enables the "Enable task planning with estimated hours?" setting in the administration panel.

@copilot check my previous comment

Yes, I've addressed your previous comment. The task planning feature now includes:

✅ Global setting to activate the feature (enableTaskPlanning)
✅ Estimated hours field in the BlazeJS template
✅ Conditional display based on the global setting

All changes are implemented in commit 8480d92.

Copilot AI changed the title Implement per-task time tracking and predefined tasks API for improved billing analysis Implement per-task time tracking with global setting control and enhanced UI integration Aug 19, 2025
Copilot AI requested a review from faburem August 19, 2025 19:57
@faburem
Copy link
Collaborator

faburem commented Aug 20, 2025

@copilot you only added the English translation, please also add the new estimated hours translation key for all supported languages

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot you only added the English translation, please also add the new estimated hours translation key for all supported languages

I've added the missing translations for the estimated hours field in all supported languages. The translation keys enable_task_planning and estimatedHours are now available in:

  • German (de.json)
  • Spanish (es.json)
  • French (fr.json)
  • Russian (ru.json)
  • Ukrainian (ukr.json)
  • Chinese (zh.json)

All translation files have been validated for correct JSON syntax. Changes committed in d51aaf3.

@faburem
Copy link
Collaborator

faburem commented Aug 21, 2025

@copilot I noticed that the estimated hours are only shown in the task modal but not in the task list (track/components/projectTasks) - can you also add the column to the task table but displayed only conditionally depending on the newly introduced globalsetting "enableTaskPlanning"

Copy link
Contributor Author

Copilot AI commented Aug 21, 2025

@copilot I noticed that the estimated hours are only shown in the task modal but not in the task list (track/components/projectTasks) - can you also add the column to the task table but displayed only...

I've added the estimated hours column to the project tasks table with conditional display based on the enableTaskPlanning global setting. The column appears after the dependencies column and only shows when the setting is enabled.

Key changes in commit a39adb6:

  • Modified taskMapper function to include estimated hours data when setting is enabled
  • Added conditional column definition for estimated hours with proper translation
  • Subscribed to global settings for reactive updates
  • Column uses the existing estimatedHours translation key

The estimated hours column will automatically appear/disappear when administrators toggle the "Enable task planning with estimated hours?" setting in the administration panel.

Table Layout

Copilot AI changed the title Implement per-task time tracking with global setting control and enhanced UI integration Implement per-task time tracking with global setting control and enhanced UI integration including task table display Aug 21, 2025
@faburem faburem marked this pull request as ready for review August 22, 2025 07:54
@faburem
Copy link
Collaborator

faburem commented Aug 22, 2025

@copilot we should also add two more columns to the project tasks component showing the actual tracked hours for a task and the variance similar to how it is done in the API endpoint already. As a bonus we could also add a progress bar showing the actual vs. estimate in percent in this same table.

Copy link
Contributor Author

Copilot AI commented Aug 22, 2025

@copilot we should also add two more columns to the project tasks component showing the actual tracked hours for a task and the variance similar to how it is done in the API endpoint already. As a bon...

I've added the requested columns to the project tasks table with conditional display based on the enableTaskPlanning global setting:

  • Actual Hours: Shows total tracked time for each task
  • Variance: Displays actual - estimated hours with color coding (red for over-budget, green for under-budget)
  • Progress Bar: Visual indicator showing actual vs estimated percentage with color-coded status

All columns include complete translations for all supported languages. The progress bar uses Bootstrap styling with green (≤100%), yellow (100-110%), and red (>110%) color coding for easy project health assessment.

Changes committed in d4fbd4d.

Copilot AI changed the title Implement per-task time tracking with global setting control and enhanced UI integration including task table display Implement per-task time tracking with global setting control, enhanced UI integration, and comprehensive project performance analytics Aug 22, 2025
@faburem
Copy link
Collaborator

faburem commented Aug 22, 2025

@copilot I noticed that the number format is different in many places, can you please make sure the same (existing) global setting is used everywhere to format numbers displayed in the UI in the same way?

Copy link
Contributor Author

Copilot AI commented Aug 22, 2025

@copilot I noticed that the number format is different in many places, can you please make sure the same (existing) global setting is used everywhere to format numbers displayed in the UI in the same ...

I've updated the number formatting to use the existing global precision setting consistently throughout the UI. All numeric displays in the project tasks table now use the proper helper functions:

  • timeInUserUnit() for hours-related values (actual hours, variance)
  • numberWithUserPrecision() for other numeric values (progress percentage)

This ensures all numbers display with the same precision as configured in the user settings, providing a consistent user experience. Changes committed in b9bb63a.

@faburem faburem merged commit 7a4aa85 into master Aug 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Enable Per-Task Time Tracking and Predefined Tasks API for Improved Billing and Integration

2 participants