Skip to content

Instantly share code, notes, and snippets.

@afa
Created January 13, 2012 10:23
Show Gist options
  • Save afa/1605422 to your computer and use it in GitHub Desktop.
Save afa/1605422 to your computer and use it in GitHub Desktop.
найти и распечатать ремайновских авторо-ватчеров для активных задач
(Issue.all(:conditions=>{:author_id => 45}).map(&:id) + Watcher.all(:conditions=>{:watchable_type => "Issue", :user_id => 45 }).map(&:watchable_id)).uniq.map{|i| Issue.find(i) }.select{|it| ["Новый", "Разработка", "Тестирование", "Проектирование", "Оценка результатов", "На перенос", "Перенесено", "К разработке"].include?(it.status.name) }.sort_by{|it| it.id }.each{|it| puts [it.id, it.tracker.name.inspect, it.status.name.inspect, it.priority, it.subject.inspect, it.author.name.inspect, (it.assigned_to.try(:name) || "").inspect, it.start_date, it.due_date, it.done_ratio, it.custom_field_values.select{|f| f.custom_field_id == 22 }.map(&:value).join(':').inspect].join(', ') }.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment