Skip to content

Instantly share code, notes, and snippets.

@siassaj
Created September 13, 2012 11:45
Show Gist options
  • Save siassaj/06f5332bbe3c9c3293de to your computer and use it in GitHub Desktop.
Save siassaj/06f5332bbe3c9c3293de to your computer and use it in GitHub Desktop.
def self.hash_by_comweek_fyear(comweek=0, fyear=0)
orders = self.by_comweek_fyear(comweek, fyear)
if orders.empty? then return nil end
o_miny,o_maxy = orders.minmax_by(&:fyoc)
o_maxy.downto(o_miny).each do |y|
ords = orders.select { |o| o.fyoc == y }
unless ords.empty?
o_minw,o_maxw = orders.minmax_by(&:comweek)
o_maxw.downto(o_minw).each do |w|
os = ords.select { |o| o.comweek == w }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment