Problems with duplicating Due Date Issue field - tried with Computer Custom Field.. any help?

Added by Federico C 8 months ago

Hello,

i'd need to essentially duplicate the 'Due date' field in each issue or Redmine 3.4, in a way that the user is able to edit the field, but if any child issue's got a further due date, the latter is attributed to the parent issue as well. The 'Due date' and the new field (e.g. 'Internal deadline', visible only to certain user groups) data should not be related to eachother.

I started trying to create a plugin, but i'm having some difficulties.. so I tried using the Computed Custom Field plugin and created an 'Internal deadline' date field, with the computer custom field code looking like, among many trials (this one inspired by https://github.com/annikoff/redmine_plugin_computed_custom_field/issues/15):

INTERNAL_DEADLINE_FIELD = 6

if children.any?
  deadline_children = children.select { |child| !child.custom_field_value(INTERNAL_DEADLINE_FIELD).nil? }
  if !deadline_children.nil?
    deadline_children.max { |child| child.custom_field_value(RESULT_SCORE_CF_ID).to_f }/scored_children.size
  end
end

Unfortunately, no value gets calculated to the field at all. what could it be wrong? any suggestion with the code and\or the methods?

Thank you! Any help appreciated.