Issue #166 - Sort measures alphabetically in GUI#795
Merged
Conversation
antonszilasi
commented
Mar 10, 2025
antonszilasi
commented
Mar 10, 2025
antonszilasi
commented
Mar 10, 2025
Contributor
Author
macumber
reviewed
Mar 12, 2025
macumber
reviewed
Mar 12, 2025
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
macumber
reviewed
Mar 12, 2025
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
macumber
reviewed
Mar 12, 2025
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
macumber
reviewed
Mar 12, 2025
macumber
reviewed
Mar 12, 2025
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
….cpp Co-authored-by: Dan Macumber <dan.macumber@gmail.com>
…rType or tid has changed
+ // std::sort(responses.begin(), responses.end(), [](const BCLSearchResult& a, const BCLSearchResult& b) {
+ // return a.name() < b.name();
+ // });
Contributor
Author
macumber
reviewed
Apr 24, 2025
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
macumber
reviewed
Apr 24, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR addresses Issue #166 by updating the GUI to display measures in alphabetical order. Key changes include:
- Adding a new function fetchAndSortResponses to retrieve and sort responses from the remote BCL.
- Introducing an overall response cache (m_allResponses) and pagination logic within setTid.
- Refactoring the setTid method to refresh responses only if the filter and search criteria change.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/shared_gui_components/BuildingComponentDialogCentralWidget.hpp | Added include and declarations for the new response fetching and caching mechanism. |
| src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp | Implemented fetching, sorting, and pagination of responses; updated setTid to use the new method. |
src/shared_gui_components/BuildingComponentDialogCentralWidget.hpp
Outdated
Show resolved
Hide resolved
jmarrec
approved these changes
Jul 4, 2025
Comment on lines
+193
to
+197
| if (!responses.empty()) { | ||
| std::sort(responses.begin(), responses.end(), [](const BCLSearchResult& a, const BCLSearchResult& b) { | ||
| return a.name() < b.name(); | ||
| }); | ||
| } |
Collaborator
There was a problem hiding this comment.
If I'm following correctly, you just factored a bit of code into a function, and added this bit that sorts the results.
Side note: the if (!responses.empty()) is not technically needed and does not make it faster. https://quick-bench.com/q/5lPbGyQNKctVRq7IdoD_fUVTPt4
(Running it a bunch of times locally produces results where one is sometimes faster than the other, so they're the same).
-----------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------
SortNoIf_Items 4732 ns 4730 ns 147972
SortWithIf_Items 5040 ns 5038 ns 138705
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.