ajour / ajour

A World of Warcraft addon manager written in Rust.
https://getajour.com/
GNU General Public License v3.0
1.02k stars 86 forks source link

Sorting catalog with a search term present yields incorrect results. #595

Open credomane opened 3 years ago

credomane commented 3 years ago

Describe the bug Sorting catalog with a search term present yields incorrect results.

To Reproduce Steps to reproduce the behavior:

  1. Go to catalog tab
  2. Enter a search term. For this bug report I shall use plater.
  3. Using plater you have about 25 results.
  4. sort the list by name in ascending order.
  5. plater is not in the list of 25 addons anymore plus these addons are not all the same addons as the unsorted list.
  6. sort the list by name in descending order.
  7. plater is in the list again but these are again not addons that were in the unsorted list as well as the ascending sorted list.

Expected behavior The original 25 addons that appear when searching for plater to get sorted. Not what ever is actually happening.

Screenshots Shouldn't be needed but can add them if they are still desired.

Software involved Please complete the following information:

Additional context This affects the other columns in the catalog tab for sorting as well with a search term present. My Addons seems to sort without issues when a search term is present.

Log Output Wanted to put this into a spoiler tag so it could be minimized but github refuses to allow any formatting/new lines and the entire log becomes one giant line.

21:56:05.493 [ajour][INFO] Ajour 1.0.0 has started.
21:56:05.493 [ajour::gui][DEBUG] config loaded:
Config {
    wow: Wow {
        directory: Some(
            "/mnt/evo850/credomane/Lutris/battlenet/drive_c/Program Files (x86)/World of Warcraft",
        ),
        directories: {},
        flavor: Classic,
    },
    addons: Addons {
        global_release_channel: Stable,
        ignored: {
            Classic: [],
        },
        release_channels: {
            Classic: {},
        },
        delete_saved_variables: false,
    },
    theme: None,
    column_config: V3 {
        my_addons_columns: [
            ColumnConfigV2 {
                key: "title",
                width: None,
                hidden: false,
            },
            ColumnConfigV2 {
                key: "local",
                width: Some(
                    150,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "remote",
                width: Some(
                    150,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "status",
                width: Some(
                    85,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "channel",
                width: Some(
                    85,
                ),
                hidden: true,
            },
            ColumnConfigV2 {
                key: "author",
                width: Some(
                    85,
                ),
                hidden: true,
            },
            ColumnConfigV2 {
                key: "game_version",
                width: Some(
                    110,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "date_released",
                width: Some(
                    110,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "source",
                width: Some(
                    110,
                ),
                hidden: true,
            },
            ColumnConfigV2 {
                key: "summary",
                width: Some(
                    110,
                ),
                hidden: true,
            },
        ],
        catalog_columns: [
            ColumnConfigV2 {
                key: "addon",
                width: None,
                hidden: false,
            },
            ColumnConfigV2 {
                key: "description",
                width: Some(
                    150,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "source",
                width: Some(
                    110,
                ),
                hidden: true,
            },
            ColumnConfigV2 {
                key: "num_downloads",
                width: Some(
                    105,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "game_version",
                width: Some(
                    105,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "date_released",
                width: Some(
                    105,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "install",
                width: Some(
                    85,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "categories",
                width: Some(
                    85,
                ),
                hidden: true,
            },
        ],
        aura_columns: [
            ColumnConfigV2 {
                key: "title",
                width: None,
                hidden: false,
            },
            ColumnConfigV2 {
                key: "local",
                width: Some(
                    120,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "remote",
                width: Some(
                    120,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "author",
                width: Some(
                    85,
                ),
                hidden: false,
            },
            ColumnConfigV2 {
                key: "status",
                width: Some(
                    110,
                ),
                hidden: false,
            },
        ],
    },
    window_size: Some(
        (
            837,
            772,
        ),
    ),
    scale: None,
    backup_directory: Some(
        "/home/credomane/ownCloud/games/WorldOfWarcraft/backups",
    ),
    backup_addons: true,
    backup_wtf: true,
    hide_ignored_addons: false,
    self_update_channel: Stable,
    weak_auras_account: {},
    alternating_row_colors: false,
    language: English,
    catalog_source: Some(
        Curse,
    ),
    auto_update: false,
}
21:56:05.493 [ajour::gui][DEBUG] antialiasing: true
21:56:05.602 [ajour_core::utility][DEBUG] checking for application update
21:56:05.602 [ajour_core::theme][DEBUG] loading user themes
21:56:05.610 [ajour_core::fs::theme][DEBUG] loaded 0 user themes
21:56:05.736 [ajour::gui::update][DEBUG] Message::CachesLoaded(error: false)
21:56:05.736 [ajour::gui::update][DEBUG] Message::ThemesLoaded(0 themes)
21:56:05.785 [ajour::gui::update][DEBUG] Message::Parse
21:56:05.785 [ajour::gui::update][DEBUG] preparing to parse addons in "/mnt/evo850/credomane/Lutris/battlenet/drive_c/Program Files (x86)/World of Warcraft/_classic_/Interface/AddOns"
21:56:05.785 [ajour_core::parse][DEBUG] Classic - parsing addons folder
21:56:05.785 [ajour_core::parse][DEBUG] Classic - 81 folders in AddOns directory to parse
21:56:05.785 [ajour_core::parse][DEBUG] Classic - 81 fingerprints: 81 cached, 0 calculated, 0 added, 0 removed
21:56:05.788 [ajour_core::parse][DEBUG] Classic - 81 addon folders successfully parsed from '.toc'
21:56:05.788 [ajour_core::parse][DEBUG] Classic - 5 valid cache entries retrieved
21:56:05.788 [ajour_core::parse][DEBUG] Classic - 75 unique fingerprints to check against curse api
21:56:05.808 [ajour::gui::update][DEBUG] Message::LatestBackup(None)
21:56:05.808 [ajour::gui::update][DEBUG] Message::CheckWeakAurasInstalled(Classic, is_installed: true)
21:56:05.808 [ajour::gui::update][DEBUG] Message::ListWeakAurasAccounts(Classic, num_accounts: 1)
21:56:06.105 [ajour::gui::update][DEBUG] Message::ParsedAuras(Classic, num_auras: 2)
21:56:06.230 [ajour::gui::update][DEBUG] Message::LatestRelease(Some("1.0.0"))
21:56:06.589 [ajour_core::catalog][DEBUG] Etag match, cached catalog is latest version
21:56:06.656 [ajour::gui::update][DEBUG] Message::CatalogDownloaded(16033 addons in catalog)
21:56:07.163 [ajour_core::parse][DEBUG] Classic - 50 curse packages fetched
21:56:07.323 [ajour_core::parse][DEBUG] Classic - 4 tukui packages fetched
21:56:07.661 [ajour_core::parse][DEBUG] Classic - 9 wowi packages fetched
21:56:07.661 [ajour_core::parse][DEBUG] Classic - 0 townlong packages fetched
21:56:07.661 [ajour_core::parse][DEBUG] Classic - 0 git packages fetched
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 46 addons built from curse packages
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 4 addons built from tukui packages
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 1 addons built from wowi packages
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 0 addons built from townlong-yak packages
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 0 addons built from git packages
21:56:07.662 [ajour_core::parse][DEBUG] Classic - 1 unknown addon folders
21:56:07.663 [ajour_core::parse][DEBUG] Classic - 52 addons successfully parsed
21:56:07.665 [ajour::gui::update][DEBUG] Message::ParsedAddons(Classic, 52 addons)
21:56:11.768 [ajour::gui::update][DEBUG] Interaction::ModeSelected(MyWeakAuras(Classic))
21:56:12.239 [ajour::gui::update][DEBUG] Interaction::ModeSelected(Catalog)
21:56:16.025 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
21:56:17.297 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
21:56:18.452 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
21:56:18.914 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
21:56:20.920 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
21:57:11.393 [ajour::gui::update][DEBUG] Interaction::ModeSelected(MyAddons(Classic))
21:57:18.106 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Asc)
21:57:19.088 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Desc)
21:57:20.136 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Asc)
21:57:25.359 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Asc)
21:57:26.105 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Desc)
21:57:27.114 [ajour::gui::update][DEBUG] Interaction::SortColumn(Title, Asc)
21:57:32.750 [ajour::gui::update][DEBUG] Interaction::ModeSelected(Catalog)
21:57:38.831 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
21:57:39.903 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
21:57:51.448 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
21:57:52.725 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
21:57:59.885 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(NumDownloads, Asc)
21:58:00.604 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(NumDownloads, Desc)
21:58:04.163 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
21:58:13.911 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Description, Asc)
21:58:15.172 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Description, Desc)
21:58:16.590 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
22:00:53.082 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
22:00:53.616 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
22:00:57.331 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
22:01:00.095 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
22:01:03.858 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
22:01:06.052 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
22:01:07.097 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
22:01:09.887 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
22:02:17.380 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Desc)
22:02:21.182 [ajour::gui::update][DEBUG] Interaction::SortCatalogColumn(Title, Asc)
casperstorm commented 3 years ago

These closed issues might be relevant for this issue: https://github.com/ajour/ajour/issues/462 https://github.com/ajour/ajour/issues/517.

credomane commented 3 years ago

Ah. If I understand those issues then it almost sounds like, to me, that sorting is happening at the wrong time, imo.

unsorted list is something like enter search term -> score results -> chop list to top 25 -> show them. sorted list is something like enter search term -> score results -> sort results by selected column-> chop list to top 25 -> show them.

While I'm expecting enter search term -> score results -> chop list to top 25 -> sort results by selected column -> show them.

That sounds reasonable to me on what is happening and would certainly yield results like I'm seeing.

casperstorm commented 3 years ago

I agree - there's room for improvements on it! Ill keep this issue open so we can later tag it when its picked up. Thanks for the detailed description as well.

tarkah commented 3 years ago

Why would we want to chop down the list to 25 BEFORE sorting? We will never see the bottom results when sorting by Descending on a column.

Think of the # of results in the same context as pagination. Filtering / sorting doesn't occur within the context of the current page, it happens on the entire result set. Then you page over the results in whatever sorted order.

credomane commented 3 years ago

Why would we want to chop down the list to 25 BEFORE sorting? We will never see the bottom results when sorting by Descending on a column.

I think your logic is a little faulty there. If the total results are more than 50 before displaying only 25 of them. Then sorting any column in either direction we'll never be able to see the ones in the middle, either.

Think of the # of results in the same context as pagination. Filtering / sorting doesn't occur within the context of the current page, it happens on the entire result set. Then you page over the results in whatever sorted order.

If there was a way to page over the results in whatever sorted order in ajour then I'd agree that this is how the sorting of the results should be done and this ticket would never have existed. Since there are no options for pagination then only the displayed items should be sorted. Maybe my original explanation was not good enough?

At any time there are technically two lists of items. The full result set and the displayed result set. Sorting the entire result set only makes sense if there are options for switching pages so you can look at other results past the first 25 (or whatever the Results dropdown is set at). Since ajour currently doesn't have any pagination options to change pages then my expectation is for sorting to only sort the displayed result.

Here are some picture with explanations:

I search for "plater" and limit the results 25 as in the below screenshot. With the way the UI is presented (no pagination buttons to switch "pages" ) and worded (Results: 25 not something like Display 25 per page), to me, it doesn't work as expected. There is no indicator anywhere in the UI that there are more that 25 results be that 30, 100, 9001, or something else. Ajour makes it appear that the entire result set is 25 items for "plater", period, no exceptions. image

Yes, you and I both know that there are actually more than 25 results but the UI does nothing to hint at that. So If I click on any of the column headers to sort I expect it to sort the displayed list of 25 results. Instead what happens is the sorting is done on the full result set and get strange results like this: image

I guess what I'm getting at is:
Without pagination options I, intuitively, expect sorting to occur on the displayed list.
With pagination buttons I would expect the sorting to occur on the full result set.

Speaking of strange results....what is sorting by Addon even sorting by? I assumed it would be alphabetical by the addon's name but that doesn't appear to be the case.

tarkah commented 3 years ago

@credomane Thanks for the detailed explanation. I think our implementation is fine, but I agree it is slightly confusing in presentation. We should indicate, as you mention, that its only displaying 25 out of X total addons. I can't figure out a scenario when we'd only want to sort things within the context of the displayed results vs the full list respective to filters.

And it is sorting by title properly, it's just that sorting goes from A-Za-z (we can sort on lowercase to fix this)

credomane commented 3 years ago

And it is sorting by title properly, it's just that sorting goes from A-Za-z (we can sort on lowercase to fix this)

I figured out why it was confusing me so much. I thought I had the screenshot sorting ascending but it is actually sorting descending. I didn't catch on to that and was wondering why they were in semi-random order. It was so obvious what the deal was today I dunno why I didn't notice that yesterday.