Created
May 24, 2012 13:14
-
-
Save phlegx/2781493 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET /feedback_channels/new | |
# GET /feedback_channels/new.xml | |
def new | |
@feedback_channel = FeedbackChannel.new | |
get_analogue_channels | |
respond_to do |format| | |
format.html # new.html.erb | |
format.xml { render :xml => @feedback_channel } | |
end | |
end | |
######## | |
def get_analogue_channels | |
@all_analogue = ["None"] | |
@channel_weight_sum = 0 | |
#all_weights = FeedbackChannel.find(:all).channel_weight | |
channels = FeedbackChannel.find(:all) | |
channels.each do |channel| | |
if channel.analogue_channel then | |
if @feedback_channel.name != channel.name | |
@all_analogue.push(channel.name) | |
end | |
end | |
if not channel.channel_weight.nil? then | |
@channel_weight_sum += channel.channel_weight.to_i | |
end | |
end | |
STDERR.puts("<<<--------------->>>>") | |
STDERR.puts @channel_weight_sum = 100 - @channel_weight_sum | |
STDERR.puts("<<<<--------------->>>>") | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment