anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
182 stars 72 forks source link

calculate the number of subtasks #262

Closed frankz96 closed 2 years ago

frankz96 commented 2 years ago

Hi there. I want to calculate the number of subtasks and save it to a custom field value. Is there anyone can help me?

picman commented 2 years ago
n = @issue.descendants.visible.all.size
@issue.custom_values.each do |cv|
  if cv.custom_field_id == 74 # Your CF ID
    cv.value = n
    cv.save
    break
  end
end
frankz96 commented 2 years ago
n = @issue.descendants.visible.all.size
@issue.custom_values.each do |cv|
  if cv.custom_field_id == 74 # Your CF ID
    cv.value = n
    cv.save
    break
  end
end

Thank you so mcuh! It's working.