Comparing numbers in seperate templates?

Lets say theres two templates, each that have an ul with a couple of li inside that contain generated values from helpers. How could you go about comparing the values of corresponding list items in the different templates? Eg. 2 Separate lists:

`

  • 2000
  • 1000
  • 0
  • `

    compared to

    `

  • 3000
  • 1000
  • 0
  • `

    and then be able to highlight the list item with the greatest value.

    You could store the values in a Session variable to make it reactive and find the max number.

    Yea thats pretty much what i ended up doing. Check this out though:

    I have a helper compare that returns a css class that simply highlights the text. “better” makes it green, “worse” colors it red. Basically the function compares 2 numbers (the compare function thats commented out does the same as the ternary below it). How can i compare multiple values in the same helper function? I know i could just create a bunch more helper functions and compare all the data 1 by 1, but im sure theres a better way. Heres what the template looks like :