View Single Post
Old 12-25-2022, 12:33 PM   #444
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
two questions:

a) Why does list_union seem to work in reverse? (e.g. if I put 'omnibus' first in template, it appears at the end of the list).
list_union and several other list operations don't guarantee order.
Quote:
b) Currently, an icon rule checks #admin_tags for 'omnibus.' Would there be any performance impact by checking the composite column instead?
The composite will be slower, possibly much slower. The template must be evaluated for every book being displayed. If it is evaluated in any event, for example to display the computed list, then the performance penalty is much reduced.

FWIW: Since you want Omnibus at the head of the list, I would write the template like this.
Code:
program:
## Splitting tags
	if 
		'^(Fiction|Nonfiction|Magazines & Periodicals)' in $#booktyoe 
	then 
		split_tags = re($tags, '\.', ',') 
	else
		split_tags = ''
	fi;

## Removing a few unwanteds and sorting
	cleaned_tags = list_sort(list_difference(
		split_tags,
		'Fiction, Nonfiction, Magazines & Periodicals, Cultures & Regions, Social Issues',
		','), 0, ',');

## Last runthrough - Checking for omnibus
	if 
		'omnibus' 
	in 
		$tags 
	then 
		cleaned_tags  = 'Omnibus' & if cleaned_tags then ', ' & cleaned_tags fi
	fi;
	cleaned_tags
Quote:
Thanks and merry christmas (or whatever you celebrate)
Thank you. I hope the same (now past tense) for you.
chaley is offline   Reply With Quote