-
Notifications
You must be signed in to change notification settings - Fork 25
Issue #166 - Sort measures alphabetically in GUI #795
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
Conversation
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
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();
+ // });
src/shared_gui_components/BuildingComponentDialogCentralWidget.cpp
Outdated
Show resolved
Hide resolved
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.
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
| if (!responses.empty()) { | ||
| std::sort(responses.begin(), responses.end(), [](const BCLSearchResult& a, const BCLSearchResult& b) { | ||
| return a.name() < b.name(); | ||
| }); | ||
| } |
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.
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


No description provided.