Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 30, 2025

Problem

Routes that don't have any RouteInstances were completely hidden from map displays when no filters were applied. This occurred because the map data query started with the RouteInstances table, which meant only routes with at least one RouteInstance would ever be included in the results.

For example, if a user created a new route but hadn't recorded any trips (RouteInstances) on it yet, that route would be invisible on the map unless specific filters were applied.

Solution

Modified RoutesOdataController.GetGeoJsonAsync() to handle filtered and unfiltered scenarios differently:

When filters are applied (q.Filter != null):

  • Keep the existing RouteInstance-based query logic for perfect backward compatibility
  • All existing filtered queries continue to work exactly as before

When no filters are applied (q.Filter == null):

  • Query the Routes table directly instead of RouteInstances
  • Include all routes associated with the map, even those without any RouteInstances
  • Correctly count actual instances per route for the totalInstances property
  • Routes without instances display with totalInstances = 0

Example

Before this fix:

// Only routes with RouteInstances were visible
var routes = _context.RouteInstances.Where(/* conditions */)

After this fix:

if (q.Filter != null) {
    // Filtered: use existing logic (backward compatible)
    var routes = _context.RouteInstances.Where(/* filter conditions */)
} else {
    // Unfiltered: include all routes, even without instances
    var allRoutes = _context.Routes.Where(/* map conditions */)
}

Impact

  • Low Risk: Only affects unfiltered map queries
  • Backward Compatible: All existing filtered functionality preserved
  • User Experience: Users can now see and manage all their routes on maps
  • No Breaking Changes: Same API contract and output format maintained

Routes without any recorded trips are now visible on the map when no filters are applied, improving the overall usability of the route management system.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 192.168.178.30
    • Triggering command: /home/REDACTED/work/OVDB/OVDB/OV_DB/bin/Debug/net9.0/OV_DB (packet block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Routes without a routeinstance should still be shown when no filter is applied for a map</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #117

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Routes without a routeinstance should still be shown when no filter is applied for a map Fix: Include routes without RouteInstances when no filter is applied on maps Sep 30, 2025
Copilot AI requested a review from jjasloot September 30, 2025 22:43
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.

Routes without a routeinstance should still be shown when no filter is applied for a map

2 participants