Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Sorting by score after excluding a tag gave me a 500 error

+3
−0

I added a filter to exclude [tag:status-launched] and then sorted by score. I was redirected to https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=["984"]&sort=score

Here is the error code produced: 1a5cd4d1-b811-4984-a9e1-0be1fa08ade6

What did I break?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Reproduced. (2 comments)

1 answer

+2
−0

First, to quote from the 500 page:

It's not your fault.

Thanks for raising this.

Instant workaround

For your particular combination of filters and sorting criterion, here is a corrected link that you can use until the bug is fixed:

Once you are on that page, you can bookmark it if you wish, to avoid the need to keep coming back to this answer. Bear in mind that the bookmark (and this link) may stop working once the bug is fixed.

What works and what doesn't

Sorting by any criterion works fine with any filters apart from the tags filters. You don't need to avoid filters in general.

If any tags are included and/or excluded in the filter, then sorting by any criterion will fail with the 500 message mentioned. This affects all categories for all communities.

Awkward workaround

For combinations of filters and sorting criteria other than the one in the "Instant workaround" section above, you can construct your own workaround link if you wish (only necessary if your filters include tags):

  1. Apply all of the filters you want
  2. Instead of pressing a sort button, paste the appropriate sort string onto the end of the URL in the address bar on that filtered page
    • To sort by "Age", use &sort=age
    • To sort by "Score", use &sort=score
    • To sort by "Random", use &sort=lottery
  3. Press Enter on your keyboard and the page will display correctly filtered and sorted
  4. At this point you can bookmark the page or copy the URL from the address bar to share it as a link

Note that this is likely to stop working once the bug is fixed, so if you bookmark or share a particular sorted filtered list using this workaround, you may need to update it later.

Root cause (you don't need to read this section unless you're fixing the bug or curious)

There is a bug in the URL, which prevents the server from understanding it.

The behaviour for included and excluded tags is similar, as is the behaviour for 1 or multiple tags, so for brevity only multiple excluded tags are covered here.

Multiple tags excluded

The URL before sorting:

https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985

This ends in &exclude_tags[]=984&exclude_tags[]=985.

The (broken) URL after sorting:

https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags=[%22984%22,%20%22985%22]&sort=score

This ends in &exclude_tags=["984", "985"]&sort=score.

The workaround URL:

https://meta.codidact.com/categories/10?predefined_filter=&min_score=&max_score=&min_answers=&max_answers=&status=any&exclude_tags[]=984&exclude_tags[]=985&sort=score

This ends in &exclude_tags[]=984&exclude_tags[]=985&sort=score.

Potential fixes

The broken version uses a single parameter &exclude_tags followed by a comma separated list of tag ids in double quotes, whereas the working version uses a separate &exclude_tags parameter per excluded tag. This suggests one of the following approaches to fixing the bug:

  • Make clicking on a sorting button link to a URL using a separate &exclude_tags parameter per excluded tag (matching the workaround provided above)
  • Use a single &exclude_tags parameter everywhere (before and after sorting) and fix the code to be able to understand this

The first approach will probably be quicker to implement, but the second approach will avoid excessively long URLs, and I suspect was probably the original intention.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »