diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index f25d3144..fd905768 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -208,6 +208,11 @@ module ItemsHelper dyeworks_average_num_potions_for(items) * 125 end + def complexity_for(items) + max_name_length = items.map(&:name).map(&:length).max + max_name_length >= 40 ? "high" : "low" + end + def probability(p) case p when 1 diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml index fb3db7c3..d16ae107 100644 --- a/app/views/items/sources.html.haml +++ b/app/views/items/sources.html.haml @@ -11,7 +11,7 @@ [nc]: https://secure.nc.neopets.com/get-neocash [gc]: https://secure.nc.neopets.com/nickcash-cards - %table.item-list + %table.item-list{"data-complexity": complexity_for(@items[:nc_mall])} %thead %tr %td @@ -46,7 +46,7 @@ [dyeworks]: https://www.neopets.com/mall/dyeworks/ - %table.item-list{"data-complexity": "high"} + %table.item-list{"data-complexity": complexity_for(@items[:dyeworks])} %thead %tr %td.thumbnail-cell @@ -120,7 +120,7 @@ [tp]: https://www.neopets.com/island/tradingpost.phtml?type=browse [ag]: https://www.neopets.com/genie.phtml - %table.item-list + %table.item-list{"data-complexity": complexity_for(@items[:np])} %thead %tr %td @@ -147,6 +147,7 @@ %table.item-list{ "data-group-type": "bundle", "data-group-owned": items.all?(&:owned?), + "data-complexity": complexity_for(items), } %thead %tr @@ -203,7 +204,7 @@ [owls]: https://www.neopets.com/~owls - %table.item-list + %table.item-list{"data-complexity": complexity_for(@items[:other_nc])} %thead %td %th.name-cell{colspan: 2}