Skip to content

Conversation

@louisgreiner
Copy link
Contributor

Create a visual Dot for each collapsed node in a trainrun sections chain (trainrunSectionViewObject)

Code picked from mrd/demo-intermediate-collapsed-dots

Might conflict a bit with #661

@louisgreiner louisgreiner removed the request for review from aiAdrian December 4, 2025 15:49
// Count collapsed source nodes from all trainrun sections except the first one
return this.trainrunSections
.slice(1) // skip first section
.filter((section) => section.getSourceNode().getIsCollapsed()).length;
Copy link
Member

Choose a reason for hiding this comment

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

All intermediate nodes in this.trainrunSections are collapsed, do we need to check this again here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh indeed

// retrieve collapsed node count from view object
const collapsedNodeCount = trainrunSectionViewObject.getCollapsedIntermediateStopCount();
const trainrunSection = trainrunSectionViewObject.trainrunSections[0];
const numberOfStops = trainrunSection.getNumberOfStops() + collapsedNodeCount;
Copy link
Member

Choose a reason for hiding this comment

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

trainrunSection.getNumberOfStops() should always return 0 since the DTO import runs a migration to get rid of these, so I don't think we need to add that to the total?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so too, it was meant to work without the work of Clara, which is not merged yet (and then require export/import), but I can remove it anyway, it will avoid this to be forgotten along the way 😄

@louisgreiner louisgreiner requested a review from emersion December 5, 2025 15:38
@emersion
Copy link
Member

emersion commented Dec 5, 2025

I wonder if we really need this PR given #661 is almost the same code. Maybe adding a method to get the number of intermediate nodes is worthwhile, but otherwise the code seems pretty similar.

Oh, I just realized we don't want to count non-stop intermediate nodes, even if they're collapsed? In other words, we only want to draw a small disc for stops?

@emersion emersion removed their request for review December 5, 2025 16:13
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.

3 participants