indeed! how would i need to code that? could i simply replace that? fyi, the badges are defined in my config/frontend_themes/themes_badges.yaml
,
In my python script this is the relevant bit for this logic:
up_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
return "yellow_badge"; else if (value == 2) return "blue_badge"; \
else if (value == 3) return "orange_badge"; else if (value == 4) \
return "brown_badge"; else if (value == 5) return "black_badge"; \
else if (value == 6) return "grey_badge"; else if (value == 7) \
return "green_badge"'
down_theme = 'if (value == 7) return "red_badge"; else if (value == 6) \
return "yellow_badge"; else if (value == 5) return "blue_badge"; \
else if (value == 4) return "orange_badge"; else if (value == 3) \
return "brown_badge"; else if (value == 2) return "black_badge"; \
else if (value == 1) return "grey_badge"; else if (value == 0) \
return "green_badge"'
and:
groups_theme = [up_theme, up_theme, down_theme, up_theme]
first attempt is erroring out with value=undefined.
up_theme = ["red_badge","yellow_badge","blue_badge","orange_badge","brown_badge",\
"black_badge","grey_badge","green_badge"]
down_theme = ["green_badge","grey_badge","black_badge","brown_badge","orange_badge",\
"blue_badge","yellow_badge","red_badge"]
and
groups_theme = [up_theme[value], up_theme[value], down_theme[value], up_theme[value]]
or
groups_theme = [return ‘up_theme[value]’, return ‘up_theme[value]’, return ‘down_theme[value]’, return ‘up_theme[value]’ ]
—edit—
this seems to almost do the trick, always important where to put the ’ '…:
groups_theme = ['return up_theme[value]', 'return up_theme[value]', 'return down_theme[value]', 'return up_theme[value]' ]
doesn’t yet select the correct theme though, but no error messages anymore. Further tweaking needed!
Marius