Skip to content

Fix/vizualisation#29

Merged
rosasbehoundja merged 2 commits into
mainfrom
fix/vizualisation
Mar 23, 2026
Merged

Fix/vizualisation#29
rosasbehoundja merged 2 commits into
mainfrom
fix/vizualisation

Conversation

@rosasbehoundja
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 23, 2026 08:00
@rosasbehoundja rosasbehoundja merged commit 4ce0720 into main Mar 23, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the solution visualisation UI to adjust which metrics are shown and to make metric updates more resilient to missing DOM elements, and adds a new example solution .dat file.

Changes:

  • Replace the “Exchanges” metric display with a “Trucks” metric in the metrics panel.
  • Add a small setTextContentById helper and use it for stats updates to avoid null-element runtime errors.
  • Add Sol_MPVRP_S_002_s10_d2_p3.dat under data/solutions/.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pages/visualisation.html Updates the metrics grid to hide Exchanges and display Trucks.
pages/static/js/visualisation.js Adds a safe DOM text setter and updates stats rendering accordingly.
data/solutions/Sol_MPVRP_S_002_s10_d2_p3.dat Adds a new solution data file in the documented format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setTextContentById('stat-dist', (metrics.total_cost || solution.objective || 0).toFixed(2));
setTextContentById('stat-routing', (metrics.routing_cost || 0).toFixed(2));
// setTextContentById('stat-exchanges', `0/${totalExchanges}`);
setTextContentById('stat-trucks', metrics.vehicles_used || trucks.length);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

Using metrics.vehicles_used || trucks.length will incorrectly fall back to trucks.length when vehicles_used is 0 (valid numeric value but falsy). Prefer a nullish check (e.g., ??) or an explicit Number.isFinite/!= null guard so 0 is displayed correctly when that’s what the metrics report.

Suggested change
setTextContentById('stat-trucks', metrics.vehicles_used || trucks.length);
setTextContentById('stat-trucks', metrics.vehicles_used ?? trucks.length);

Copilot uses AI. Check for mistakes.
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.

2 participants