Calestian Achievement system switch control

Good day scripters,

I tried to make an addon for Calestian's Achievements script in order to control what achievements are shown based on a switch (I thought this would be the easiest to implement).
The best I was able to do was partial success where either the item wasn't drawn (but you could still move up or down and see achievement info) or there would be nothing shown.
Regardless of what I did it would always crash if you opened up too many categories. Had to do with how I was trying to process the option.

The desired effect is to only have the achievement visible if something allows it (a switch).

I tried adding in the switch option to the achievement data, but I have been unable to used this properly.
Ruby:
    1 => {
      :Name              => "To Be Discovered",
      :Tiers             => [50, 100],
      :Help              => "We can't tell you yet",
      :Title             => "Best Adventurer Ever",
      :RewardItem        => :none,
      :RewardGold        => :none,
      :Category          => "Hidden",
      :AchievementPoints => 10000,
      :Prerequisite      => :none,
      :Repeatable        => false,
      :Switch            => 167,
    },
And yes I do still need to finish my ruby course and fully read the rgss3 documentation. Apologies for that.

Can someone help or make a small snippet to do this?
convert
achievement default.png Into achievement default edited.png
Turns out this was easier than I thought. (or I got lucky - which I believe to be the case most times)
Changing one line got it working.
Ruby:
module Clstn_Achievement_System
 
  def self.get_category_achievements
    category = []
    Achievement_Categories.each { |key|
      temp = []
      Achievements.each_value { |value|
        temp.push(value[:Name]) if (value[:Category] == key[0]) &&
        ($game_switches[value[:Switch]] == true)
      }
      category.push(temp.empty? ? 0 : temp)
    }
    return category
  end

end

Original thread: https://forums.rpgmakerweb.com/threads/calestian-achievement-system-switch-control.128439/