Quote:
Originally Posted by chaley
FWIW: this template will have better performance because the sequence of comparisons is done in python instead of the template interpreter.
Code:
program:
first_matching_cmp(
$rating,
1.1, '#FEDC78',
2.1, '#94E4C9',
3.1, '#FE657D',
4.1, '#94E4C9',
'#2EAB64')
I used 1.1 instead of 1 etc. because the comparisons are 'less than'. I should have made it <= when I added first_matching_cmp() to the template language. Oh well, too late now.
|
Thanks Chaley, this is fantastic 💚