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'
);