View Single Post
Old 02-12-2023, 10:17 PM   #1
culytera
Zealot
culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.
 
Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
Proper alphanumerical sorting on tag browser

Hello! I made a template function to group word counts by certain thresholds and used it for a custom column where the results are shown on the tag browser, but they're not being sorted properly on the tag browser. It seems to only see the first digit on 5000, 10000, etc. The custom columns are already sorted by text. Same case for tags with numbers though I'm not sure if that's the intended behavior.

This is the template function with the template name getWordCountGroup.
Code:
program:
	getWordCount = field('#ao3_words');
	wordCount = re(getWordCount, '[,]', '');
	first_non_empty(
		cmp(wordCount, 5001,  'Less than 5000', '', ''),
		cmp(wordCount, 10001, 'Less than 10000', '', ''),
		cmp(wordCount, 20001, 'Less than 20000', '', ''),
		cmp(wordCount, 40001, 'Less than 40000', '', ''),
		cmp(wordCount, 80001, 'Less than 80000', '', ''),
		'Over 80000'
);
Attached Thumbnails
Click image for larger version

Name:	wordcount.jpg
Views:	112
Size:	245.1 KB
ID:	199704   Click image for larger version

Name:	tags.jpg
Views:	115
Size:	28.2 KB
ID:	199705  
culytera is offline   Reply With Quote