我这里有一些代码味道:
f.series(:name=>'Average review', :data=> [
Integer(@review.style.reviews.average(:answer01).to_f*20),
Integer(@review.style.reviews.average(:answer02).to_f*20),
Integer(@review.style.reviews.average(:answer03).to_f*20),
Integer(@review.style.reviews.average(:answer04).to_f*20),
Integer(@review.style.reviews.average(:answer05).to_f*20),
Integer(@review.style.reviews.average(:answer06).to_f*20),
Integer(@review.style.reviews.average(:answer07).to_f*20),
Integer(@review.style.reviews.average(:answer08).to_f*20),
Integer(@review.style.reviews.average(:answer09).to_f*20),
Integer(@review.style.reviews.average(:answer10).to_f*20),
]
谁能建议在单个数据库查询中处理此问题的最佳方法?