Skip to content

Comments

KAAV-2363 Muokkausnäkymän aikajanan pituudet poikkeavat Gantt-aikajanan pituuksista#657

Open
henrihaapalasiili wants to merge 7 commits intodevelopmentfrom
KAAV-2363-clean
Open

KAAV-2363 Muokkausnäkymän aikajanan pituudet poikkeavat Gantt-aikajanan pituuksista#657
henrihaapalasiili wants to merge 7 commits intodevelopmentfrom
KAAV-2363-clean

Conversation

@henrihaapalasiili
Copy link
Contributor

@henrihaapalasiili henrihaapalasiili commented Jan 7, 2026

-Align ProjectTimeline and VisTimline.
-ProjectTimeline.jsx overrides API deadlines with attribute_data dates and resizes the grid to true week counts.
-Changed helpers/createDeadlines.js to build week metadata from provided months so milestones stay aligned.
-helpers/createMonths.js keeps a 13-month window starting one month back with per-month week counts.
-helpers/helpers.js now computes findInMonths/findWeek from real dates to stay in sync with the metadata grid.
-Timeutil date compare fix.
-Timeutil unit tests fix.

Problem:
Timeline was showing wrong phase color (e.g., Käynnistys green instead of
Ehdotus red) when the visible date range contained no phase_start or
phase_end markers. This happened because:

  1. createStartAndEndPoints blindly placed phase markers if their date
    mapped to a visible slot, ignoring whether the phase was actually
    valid/active during that time
  2. The fallback logic in fillGaps iterated deadlines sequentially and
    picked the last phase_start before visible range, which was often
    the wrong phase

Solution:
Added three new helper functions:

  • getSlotDate(): Computes actual calendar date for a timeline slot
  • buildPhaseTimeline(): Pre-processes deadlines to build a map of each
    phase's effective start/end dates (earliest start, latest end)
  • findActivePhaseAtDate(): Determines which phase is active at a given
    date by checking start <= date <= end

Key changes in createStartAndEndPoints:

  • Compute visible date range from inputMonths
  • Build phase timeline and filter to only phases that overlap with
    visible range AND have valid dates (start <= end)
  • Skip phases with invalid date ordering (e.g., start > end)
  • Skip individual deadlines whose dates fall outside visible range

Key changes in fillGaps:

  • Replaced old sequential deadline iteration with proper phase lookup
  • Uses findActivePhaseAtDate to find the correct active phase at
    visible start date, ensuring correct color is displayed"

-Fixed rounding corners in timeline, texts to show up correct place and no gaps in white lines.
-When a phase_end (e.g. Käynnistys K2) landed exactly on the first
visible week of the timeline, the has_endpoint_in_range flag was not
being set in the else branch of fillGaps() (for slots with 4+ keys).

…rrides API deadlines with attribute_data dates and resizes the grid to true week counts. Changed helpers/createDeadlines.js to build week metadata from provided months so milestones stay aligned. helpers/createMonths.js keeps a 13-month window starting one month back with per-month week counts. helpers/helpers.js now computes findInMonths/findWeek from real dates to stay in sync with the metadata grid.
…range

Problem:
Timeline was showing wrong phase color (e.g., Käynnistys green instead of
Ehdotus red) when the visible date range contained no phase_start or
phase_end markers. This happened because:
1. createStartAndEndPoints blindly placed phase markers if their date
   mapped to a visible slot, ignoring whether the phase was actually
   valid/active during that time
2. The fallback logic in fillGaps iterated deadlines sequentially and
   picked the last phase_start before visible range, which was often
   the wrong phase

Solution:
Added three new helper functions:
- getSlotDate(): Computes actual calendar date for a timeline slot
- buildPhaseTimeline(): Pre-processes deadlines to build a map of each
  phase's effective start/end dates (earliest start, latest end)
- findActivePhaseAtDate(): Determines which phase is active at a given
  date by checking start <= date <= end

Key changes in createStartAndEndPoints:
- Compute visible date range from inputMonths
- Build phase timeline and filter to only phases that overlap with
  visible range AND have valid dates (start <= end)
- Skip phases with invalid date ordering (e.g., start > end)
- Skip individual deadlines whose dates fall outside visible range

Key changes in fillGaps:
- Replaced old sequential deadline iteration with proper phase lookup
- Uses findActivePhaseAtDate to find the correct active phase at
  visible start date, ensuring correct color is displayed
- Only apply 'first' rounded corners when phase actually starts (phase_start)
  or there's a real color transition (previous slot had different color)
- Only apply 'last' rounded corners when phase actually ends (phase_end)
  or there's a real color transition (next slot has different color)
- Phases continuing from before visible range (past_start_point) no longer
  get incorrect rounded left corners
- Phases continuing beyond visible range no longer get incorrect rounded
  right corners
- Fixed inner milestone width to use 100% for middle segments
- Added gap: 0 to timeline grid container
Bug: When a phase_end (e.g. Käynnistys K2) landed exactly on the first
visible week of the timeline, the has_endpoint_in_range flag was not
being set in the else branch of fillGaps() (for slots with 4+ keys).
This caused the code to incorrectly fall into the 'no endpoints in range'
special case, overwriting the entire timeline with the wrong phase color.

Fix: Set has_endpoint_in_range = true in both branches of the fillGaps
loop when a deadline_type array is detected, ensuring proper detection
regardless of the number of keys in the slot.
Check for deadline errors (is_under_min_distance_next, is_under_min_distance_previous, out_of_sync) on ALL deadlines before filtering.
Previously, if a deadline with errors was filtered out (not visible), the error message 'Projekti ei ole ajan tasalla' would not display.
@sonarqubecloud
Copy link

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.

1 participant