Buy It Now prices are prices set
by the seller, which the seller considers sufficient to stop the auction. If a user clicks Buy It Now,
he agrees to pay that price regardless of the current auction price. Since that represents a static
value set by the seller, you may consider it more accurate. You can easily check this instead of
the current auction price by replacing :CurrentPrice with :BuyItNowPrice. (Note that if you
do that, it won??™t count items without Buy It Now prices; this is because of the if statement
checking for the existence of the price element.)
As you can see, the downside is that these approaches come at the expense of having less data to
work with in your report,
Now you need to return the data to the caller of your method, as follows:
if result_count > 0
average_price = (total_price/result_count)
else
average_price = nil
end
[result_count, average_price] # Return the number of results and
# average price as an array.
end
end
The first if statement checks if you have any results.
Pages:
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191