address each point.
**Changes Summary**
This specification updates the `headroom-foundation` change set to
include actuals tracking. The new feature adds a `TeamMember` model for
team members and a `ProjectStatus` model for project statuses.
**Summary of Changes**
1. **Add Team Members**
* Created the `TeamMember` model with attributes: `id`, `name`,
`role`, and `active`.
* Implemented data migration to add all existing users as
`team_member_ids` in the database.
2. **Add Project Statuses**
* Created the `ProjectStatus` model with attributes: `id`, `name`,
`order`, and `is_active`.
* Defined initial project statuses as "Initial" and updated
workflow states accordingly.
3. **Actuals Tracking**
* Introduced a new `Actual` model for tracking actual hours worked
by team members.
* Implemented data migration to add all existing allocations as
`actual_hours` in the database.
* Added methods for updating and deleting actual records.
**Open Issues**
1. **Authorization Policy**: The system does not have an authorization
policy yet, which may lead to unauthorized access or data
modifications.
2. **Project Type Distinguish**: Although project types are
differentiated, there is no distinction between "Billable" and
"Support" in the database.
3. **Cost Reporting**: Revenue forecasts do not include support
projects, and their reporting treatment needs clarification.
**Implementation Roadmap**
1. **Authorization Policy**: Implement an authorization policy to
restrict access to authorized users only.
2. **Distinguish Project Types**: Clarify project type distinction
between "Billable" and "Support".
3. **Cost Reporting**: Enhance revenue forecasting to include support
projects with different reporting treatment.
**Task Assignments**
1. **Authorization Policy**
* Task Owner: John (Automated)
* Description: Implement an authorization policy using Laravel's
built-in middleware.
* Deadline: 2026-03-25
2. **Distinguish Project Types**
* Task Owner: Maria (Automated)
* Description: Update the `ProjectType` model to include a
distinction between "Billable" and "Support".
* Deadline: 2026-04-01
3. **Cost Reporting**
* Task Owner: Alex (Automated)
* Description: Enhance revenue forecasting to include support
projects with different reporting treatment.
* Deadline: 2026-04-15
2.5 KiB
2.5 KiB
Purpose
Calculate and display variance between allocated hours and actual hours logged, with color-coded indicators for quick assessment.
Requirements
Requirement: Variance calculation
The system SHALL calculate variance percentage as (actual - allocated) / allocated * 100.
Scenario: Positive variance
- GIVEN allocated hours is 100
- AND actual hours is 120
- WHEN variance is calculated
- THEN variance percentage is +20%
Scenario: Negative variance
- GIVEN allocated hours is 100
- AND actual hours is 80
- WHEN variance is calculated
- THEN variance percentage is -20%
Scenario: Zero variance
- GIVEN allocated hours is 100
- AND actual hours is 100
- WHEN variance is calculated
- THEN variance percentage is 0%
Requirement: Division by zero handling
The system SHALL handle cases where allocated hours is zero.
Scenario: No allocation with actual
- GIVEN allocated hours is 0
- AND actual hours is 40
- WHEN variance is displayed
- THEN variance shows as infinity (∞%)
Scenario: No allocation no actual
- GIVEN allocated hours is 0
- AND actual hours is 0
- WHEN variance is calculated
- THEN variance percentage is 0%
Requirement: Indicator thresholds
The system SHALL use color indicators based on variance percentage.
Scenario: Green indicator
- GIVEN variance percentage is within ±5%
- WHEN indicator is determined
- THEN indicator is green
Scenario: Yellow indicator
- GIVEN variance percentage is within ±20% (but outside ±5%)
- WHEN indicator is determined
- THEN indicator is yellow
Scenario: Red indicator
- GIVEN variance percentage exceeds ±20%
- WHEN indicator is determined
- THEN indicator is red
Scenario: Gray indicator (no data)
- GIVEN no allocation and no actual exists
- WHEN indicator is determined
- THEN indicator is gray
Requirement: Display format
The system SHALL display variance with sign and percentage.
Scenario: Positive display
- GIVEN variance percentage is 15.5%
- WHEN displayed
- THEN shows "+15.5%"
Scenario: Negative display
- GIVEN variance percentage is -8.2%
- WHEN displayed
- THEN shows "-8.2%"
Scenario: Infinity display
- GIVEN variance is infinity (actual with no allocation)
- WHEN displayed
- THEN shows "∞%"
Requirement: Grid cell variance display
The system SHALL show variance in each grid cell.
Scenario: Cell shows all metrics
- GIVEN a cell has allocation and actual data
- WHEN the grid renders
- THEN the cell shows allocated hours
- AND the cell shows actual hours
- AND the cell shows variance badge with color