Yep, the ePub can already contain an "author_sort" value and Calibre will import it as is, so be careful with it.
A simple solution is to use
Action Chains and install the script
Bulk Sort. This solution will rebuild all author_sorts based on the DB value.
A more advanced solution with template function:
@BetterRed you may be interested
Create the template function valid_author_sort()
Code:
program: ifelse($author_sort, author_sorts(' & '), '1', '0')
when the ifelse() allows a sensitive comparison to the text:
Code:
def evaluate(self, formatter, kwargs, mi, locals, x, y, yes, no):
if str(x) == str(y):
return yes
else:
return no
Personally, I use it to color the columns in red when "author_sort" is invalid, and as well as a saved search for quick check ma library. No need to have it in book details, one line saved.
Code:
template:"program:valid_author_sort()#@#:t:0"
And this is much faster than launching Quality Check, no need a space scraft for travel across the street.