Skip to content
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: made feed ordering case insensitive #656

Merged

Conversation

Friendly-Banana
Copy link
Contributor

Properly sorts the feeds in the sidebar, ignoring case.
Not applied to tags for now, because these are user-defined.
Is this a feature you'd consider including?

@spacecowboy
Copy link
Owner

Thanks for the PR!

This is a good change, but I think you should use Sqlite's collate feature. example:

ORDER BY display_name COLLATE NOCASE

then there is no need to include a new column in the queries.

@Friendly-Banana
Copy link
Contributor Author

I tried that, but it fails with e: [ksp] /home/runner/work/Feeder/Feeder/app/src/main/java/com/nononsenseapps/feeder/db/room/FeedDao.kt:160: There is a problem with the query: [SQLITE_ERROR] SQL error or missing database (no such column: feed_id)

@spacecowboy
Copy link
Owner

Hmm indeed. This seems to be a quirk of Sqlite. This looks like a solution (wrap it in a select)

            -- wrap in select so we can collate in order
            select * from (
                -- all items
                select $ID_ALL_FEEDS as id, '' as display_title, '' as tag, '' as image_url, sum(unread) as unread_count, 0 as expanded, 0 as sort_section, 0 as sort_tag_or_feed
                from feeds_with_items_for_nav_drawer
                -- starred
                union
                select $ID_SAVED_ARTICLES as id, '' as display_title, '' as tag, '' as image_url, sum(bookmarked) as unread_count, 0 as expanded, 1 as sort_section, 0 as sort_tag_or_feed
                from feeds_with_items_for_nav_drawer
                where bookmarked
                -- tags
                union
                select $ID_UNSET as id, tag as display_title, tag, '' as image_url, sum(unread) as unread_count, tag in (:expandedTags) as expanded, 2 as sort_section, 0 as sort_tag_or_feed
                from feeds_with_items_for_nav_drawer
                where tag is not ''
                group by tag
                -- feeds
                union
                select feed_id as id, display_title, tag, image_url, sum(unread) as unread_count, 0 as expanded, case when tag is '' then 3 else 2 end as sort_section, 1 as sort_tag_or_feed
                from feeds_with_items_for_nav_drawer
                where tag is '' or tag in (:expandedTags)
                group by feed_id
            ) as combined
            -- sort them
            order by sort_section, tag, sort_tag_or_feed, display_title collate nocase

@spacecowboy spacecowboy changed the title make feed ordering case insensitive fix: made feed ordering case insensitive Mar 11, 2025
@spacecowboy spacecowboy merged commit d5bb5c7 into spacecowboy:master Mar 11, 2025
8 of 11 checks passed
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.

2 participants