Skip to content

Instantly share code, notes, and snippets.

@eagleas
Last active March 31, 2016 10:24
Show Gist options
  • Save eagleas/7090388dd34b2dc6f54d7c551826241d to your computer and use it in GitHub Desktop.
Save eagleas/7090388dd34b2dc6f54d7c551826241d to your computer and use it in GitHub Desktop.
if depend_options[question[:id]]
hash.delete_if { |k, v| !depend_options[question[:id]].include?(k) }
depend_options[question[:id]].sum{ |opt_id| (hash[opt_id] || 0) }
else
s1 = hash.reject { |k, v|
res = cnt_replies_by_question.keys.include?(k)
puts Anketa::Question.find(k).skey if !res
res
}.values.max || 0
puts "+++ #{s1}" if s1 > 0
s2 = hash.select {|k, v| cnt_replies_by_question.keys.include?(k) }.values.max || 0
puts "---" if s2 > 0
s1 + s2
#hash.values.max || 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment