-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix station sorting #127
Fix station sorting #127
Conversation
Sort by connections status, identifier then ATIS type
WalkthroughThis pull request refines the sorting and filtering logic in the application’s main view model for ATIS stations. The changes adjust the order of ATIS station view models by updating the priority for different network connection statuses and introducing a new ordering based on ATIS type. Additionally, the code now includes an extra using directive to incorporate types from an external profiles models namespace. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as User Interface
participant VM as MainWindowViewModel
participant SL as Sorting & Filtering Logic
UI->>VM: Trigger update of ATIS stations
VM->>SL: Execute sorting (by NetworkConnectionStatus & AtisType)
SL->>VM: Return sorted and filtered station list
VM->>UI: Update display with new station order
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
vATIS.Desktop/Ui/ViewModels/MainWindowViewModel.cs (1)
130-139
: Consider extracting the ATIS type sorting logic to reduce duplication.The ATIS type sorting logic is duplicated between the main sorting and the connected stations sorting. Consider extracting it into a reusable expression.
+ private static int GetAtisTypeSortOrder(AtisType type) => type switch + { + AtisType.Combined => 0, + AtisType.Arrival => 1, + AtisType.Departure => 2, + _ => 3 + }; // In the main sorting - .ThenBy(i => i.AtisType switch - { - AtisType.Combined => 0, - AtisType.Arrival => 1, - AtisType.Departure => 2, - _ => 3 - }) + .ThenBy(i => GetAtisTypeSortOrder(i.AtisType)) // In the connected stations sorting - .ThenBy(i => i.AtisType switch - { - AtisType.Combined => 0, - AtisType.Arrival => 1, - AtisType.Departure => 2, - _ => 3 - }) + .ThenBy(i => GetAtisTypeSortOrder(i.AtisType))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
vATIS.Desktop/Ui/ViewModels/MainWindowViewModel.cs
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build (macos-latest)
- GitHub Check: build (windows-latest)
- GitHub Check: Analyze (cpp)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Analyze (csharp)
- GitHub Check: Analyze (cpp)
- GitHub Check: Analyze (csharp)
🔇 Additional comments (2)
vATIS.Desktop/Ui/ViewModels/MainWindowViewModel.cs (2)
27-27
: LGTM!The addition of the Profiles.Models namespace is necessary for the ATIS type-based sorting functionality.
96-106
: LGTM! Verify the sorting priorities.The sorting logic aligns with the PR objectives, implementing a three-tier sorting system:
- Connection status (Connected > Observer > Others)
- Identifier
- ATIS type (Combined > Arrival > Departure > Others)
Please confirm if this sorting priority matches the expected user experience:
- Should Combined ATIS have the highest priority over Arrival and Departure?
- Should Connected stations always appear before Observer stations?
Sort by connections status, identifier then ATIS type
Summary by CodeRabbit