Fixes for add_category/genre_when_multi_category settings. #884

This commit is contained in:
Jim Miller 2022-09-20 10:46:40 -05:00
parent d11d4c5263
commit 3fffd22996

View file

@ -1079,14 +1079,16 @@ class Story(Requestable):
## there's more than one category value. Does not work
## consistently well if you try to include_in_ chain genre
## back into category--breaks with fandoms sites like AO3
if listname == 'genre' and self.getConfig('add_genre_when_multi_category') and len(self.getList('category',
removeallentities=False,
# to avoid inf loops if genre/cat substs
includelist=includelist+[listname],
doreplacements=False,
skip_cache=True,
seen_list=seen_list
)) > 1:
if( listname == 'genre' and self.getConfig('add_genre_when_multi_category')
and len(self.getList('category',
removeallentities=False,
# to avoid inf loops if genre/cat substs
includelist=includelist+[listname],
doreplacements=False,
skip_cache=True,
seen_list=seen_list
)) > 1
and self.getConfig('add_genre_when_multi_category') not in retlist ):
retlist.append(self.getConfig('add_genre_when_multi_category'))
if retlist:
@ -1111,15 +1113,24 @@ class Story(Requestable):
# remove dups and sort.
retlist = sorted(list(set(retlist)))
## Add value of add_genre_when_multi_category to
## category if there's more than one category
## value (before this, obviously). Applied
## *after* doReplacements. For normalization
## crusaders who want Crossover as a category
## instead of genre. Moved after dedup'ing so
## consolidated category values don't count.
if listname == 'category' and self.getConfig('add_category_when_multi_category') and len(retlist) > 1:
retlist.append(self.getConfig('add_category_when_multi_category'))
## Add value of add_genre_when_multi_category to
## category if there's more than one category
## value (before this, obviously). Applied
## *after* doReplacements. For normalization
## crusaders who want Crossover as a category
## instead of genre. Moved after dedup'ing so
## consolidated category values don't count.
if( listname == 'category'
and self.getConfig('add_category_when_multi_category')
and len(retlist) > 1
and self.getConfig('add_category_when_multi_category') not in retlist ):
retlist.append(self.getConfig('add_category_when_multi_category'))
## same sort as above, but has to be after due to
## changing list. unique filter not needed: 'not
## in retlist' check
if not (listname in ('author','authorUrl','authorId') or self.getConfig('keep_in_order_'+listname)):
retlist = sorted(list(set(retlist)))
else:
retlist = []