def words_pos(domain, word, start, stop)
list = Position.where("`domain_id` = ? AND `word_id` = ? AND `time` BETWEEN ? AND ?", domain, word, start, stop)
positions, i = [], 0
while start < stop do
if start.to_s(:db) == list[i].time.beginning_of_day.to_s(:db)
positions << list[i].position.to_s
i += 1
else
positions << '-'
end
start += 1.days
end
return positions
end
Особенно 8-ю строку. Я не осилил Time...