Project

General

Profile

Patch #4807 » done_ratio.patch

Frédéric Senault, 2010-02-11 16:20

View differences:

mail_handler.rb 2010-02-11 16:23:57.000000000 +0100
120 120
    category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category)))
121 121
    priority = (get_keyword(:priority) && IssuePriority.find_by_name(get_keyword(:priority)))
122 122
    status =  (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
123
    done_ratio = (get_keyword(:done_ratio) && Integer(get_keyword(:done_ratio))) rescue nil
123 124

  
124 125
    # check permission
125 126
    unless @@handler_options[:no_permission_check]
......
142 143
      end
143 144
      h
144 145
    end
146
    issue.done_ratio = done_ratio if(done_ratio && (done_ratio % 10 == 0) && (0..100).include?(done_ratio))
145 147
    issue.description = cleaned_up_text_body
146 148
    # add To and Cc as watchers before saving so the watchers can reply to Redmine
147 149
    add_watchers(issue)
......
163 165
  # Adds a note to an existing issue
164 166
  def receive_issue_reply(issue_id)
165 167
    status =  (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
168
    done_ratio = (get_keyword(:done_ratio) && Integer(get_keyword(:done_ratio))) rescue nil
166 169

  
167 170
    issue = Issue.find_by_id(issue_id)
168 171
    return unless issue
......
179 182
    if status && issue.new_statuses_allowed_to(user).include?(status)
180 183
      issue.status = status
181 184
    end
185
    issue.done_ratio = done_ratio if(done_ratio && (done_ratio % 10 == 0) && (0..100).include?(done_ratio))
182 186
    issue.save!
183 187
    logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
184 188
    journal
    (1-1/1)