Feature #7376 » changeset.diff
| app/models/changeset.rb 2013-11-06 08:41:46.000000000 +0100 → app/models/changeset.rb 2013-11-26 00:34:25.000000000 +0100 | ||
|---|---|---|
|
(\d+([\.,]\d+)?)h?
|
||
|
)
|
||
|
/x
|
||
|
DONERATIO_RE = /
|
||
|
(
|
||
|
(100)
|
||
|
|
|
||
|
(\d0)
|
||
|
)
|
||
|
/x
|
||
|
def scan_comment_for_issue_ids
|
||
|
return if comments.blank?
|
||
| ... | ... | |
|
referenced_issues = []
|
||
|
comments.scan(/([\s\(\[,-]|^)((#{kw_regexp})[\s:]+)?(#\d+(\s+@#{TIMELOG_RE})?([\s,;&]+#\d+(\s+@#{TIMELOG_RE})?)*)(?=[[:punct:]]|\s|<|$)/i) do |match|
|
||
|
comments.scan(/([\s\(\[,-]|^)((#{kw_regexp})[\s:]+)?(#\d+(\s+@#{TIMELOG_RE})?(\s+#{DONERATIO_RE}%)?([\s,;&]+#\d+(\s+@#{TIMELOG_RE})?(\s+#{DONERATIO_RE}%)?)*)(?=[[:punct:]]|\s|<|$)/i) do |match|
|
||
|
action, refs = match[2], match[3]
|
||
|
next unless action.present? || ref_keywords_any
|
||
|
refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m|
|
||
|
issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2]
|
||
|
refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?(\s+#{DONERATIO_RE}%)?/).each do |m|
|
||
|
issue, hours, ratio = find_referenced_issue_by_id(m[0].to_i), m[2], m[17]
|
||
|
if issue
|
||
|
referenced_issues << issue
|
||
|
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase)
|
||
|
log_time(issue, hours) if hours && Setting.commit_logtime_enabled?
|
||
|
done_ratio(issue, ratio) if ratio
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
def done_ratio(issue, ratio)
|
||
|
issue.reload
|
||
|
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag(issue.project)))
|
||
|
issue.done_ratio = ratio.to_i
|
||
|
unless issue.save
|
||
|
logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger
|
||
|
end
|
||
|
issue
|
||
|
end
|
||
|
def split_comments
|
||
|
comments =~ /\A(.+?)\r?\n(.*)$/m
|
||
|
@short_comments = $1 || comments
|
||