# Feature RESMA-84 - Also put overscheduled hours in the My Work allocation plan

Project: Stream Resource Management
Status: tested
URL: https://community.openproject.org/work_packages/RESMA-84

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 18.0.0 |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Spent time | Module |
| --- | --- | --- | --- | --- | --- | --- | --- |
| RESMA-90 | Bug | User can allocate work hours for another user on a non-working day | rejected |  | 18.0.0 |  | Modules and project features / Resource management |

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Resource management |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan | Enterprise / Premium (PRE) |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Klaus Zanders |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

**As** a user who has resource allocations  
**I want to** see all of my allocated time in **My work**, including the part that does not fit into my working hours  
**so that** I know what is expected of me when a resource planner has knowingly allocated more than my capacity

**Acceptance criteria**

*   When an allocation does not fit into the user&#x27;s capacity within its window (the resource planner was warned about the overbooking and saved it anyway), the time that does not fit is distributed over the days of that allocation&#x27;s window as time beyond the working hours.
    
*   For every allocation, the time placed within capacity plus the time distributed beyond it adds up to the allocated time. No allocated time is silently dropped.
    
*   Time beyond the working hours is only placed on days the user works: weekends, global non-working days, the user&#x27;s non-working times and days before their first working schedule receive none.
    
*   If an allocation&#x27;s window contains no working day at all, its time is not placed on any day; the allocation shows the time that could not be planned instead (exact presentation to be defined by design).
    
*   The stack, calendar and list views of My work show the distributed time on the allocation and count it in the day totals, so that the existing &quot;over working hours&quot; highlighting of the totals applies.
    
*   The allocation card and the list row make visible which part of the allocation is beyond the working hours (presentation to be defined by design).
    
*   Time logged on the work package that day reduces the remaining allocated time as it does today, including the part beyond the working hours.
    
*   The overbooking warning and the fit check in the resource planner behave as before.
    
*   The strategy for distributing the time over the window (e.g. proportional to each day&#x27;s capacity, levelled across days, towards the end of the window, or towards its start) is decided before implementation.
    

**Technical notes**

*   `ResourceAllocations::FitCalculator` places each allocation&#x27;s work earliest-deadline-first, only within the allocation&#x27;s window and only within each day&#x27;s capacity. Work that does not fit by the end of the window remains in `Result#unscheduled`.
    
*   `ResourceAllocations::Availability#optimal_schedule` builds the `ScheduledEntry` objects from `Result#placements` only and discards `Result#unscheduled`. The overbooking warning comes from `ResourceAllocations::OverbookingAnalysis`, which does not place the excess either. As a result, over-allocated time does not appear anywhere in **My work** today.
    
*   With earliest-deadline-first, the allocation losing time is the one with the latest deadline in the overbooked range; ties are broken by start date and then by id.
    
*   _**Proposed approach**_: keep `FitCalculator` as it is and add a second pass that distributes each allocation&#x27;s `unscheduled` minutes over its own window as time beyond capacity. Distributing per allocation keeps allocations independent of each other; a levelling strategy would couple them.
    
*   Minutes are integers: round down per day and hand out the remainder by largest fractional part, so the totals per allocation stay exact.
    
*   `ScheduledEntry` needs to carry the time beyond capacity separately from the time within capacity (e.g. an `overtime_minutes` attribute), so that the views can show and label both.
    
*   The remaining-time calculation exists twice and both need to take the new time into account: `remainingHours` / `remainingAllocations` in `frontend/src/stimulus/helpers/resource-allocation-event.ts` and `My::Work::RemainingAllocations`.
    
*   If the schedule is persisted later: distributing time over an allocation&#x27;s whole window means a change on a given day can also change earlier days within the windows of the allocations active on that day. A recomputation would have to start at the earliest start date of those allocations.
    
*   Specs: cover overbooked windows in the `FitCalculator` and `Availability` specs, including allocations whose windows contain no working day.
    

**Permissions and visibility considerations**

*   _To whom is this feature visible?_ The user the allocations belong to, in their **My work** views, with the resource management enterprise feature active.
    
*   _When is it not visible?_ Without the resource management enterprise feature. Allocations on work packages the user cannot see still count towards the distributed time but keep showing the &quot;Work package not visible to you&quot; placeholder.
    

**Out of scope**

*   Changing the overbooking warning or the fit check in the resource planner.
    
*   Showing the distributed time in the resource planner&#x27;s views.
    
*   Rescheduling based on logged time (moving unfinished work to later days).
    
*   Persisting the computed schedule and improving the performance of the schedule computation.
