Yesterday’s refactoring to the ReportsController helped to move some of the ActiveRecord::Base#select_all methods out of the controller but I was still left with the duplication in the Issue model. Today, I’ll dig into those model methods and remove most of the duplication. The Refactoring Before 1 2 3 4 5 6 7 8 9 10 …
Tag: move-method
Daily Refactor #8: Move method in the ReportsController
The Refactoring This is the first part to a larger refactoring of the ReportsController in Redmine. This controller is responsible for calculating the total number of issues based on different criteria (e.g. issue status, issue priority). There are two big problems with the current code: It has a lot of duplication, both in the main …
Daily Refactor #6: Move recipients method to acts_as_event
This week I’m planning to do some refactoring on Redmine’s code base. Today I fixed a smell that Caliper found with flay. The Refactoring Redmine has several model objects that generate Events, which are listed on it’s Activity Page and cause email notifications to be sent. A few of these models had identical recipients methods …
Daily Refactor #2: Move Method in the BulkTimeEntriesController – saving a new TimeEntry
The Refactoring Following up to yesterday’s refactoring, today I kept refactoring the Bulk Time Entry plugin’s controller. The save_time_entry_from_params method I extracted yesterday only uses the TimeEntry class, so it would be perfect to move the method to the TimeEntry class. Since the TimeEntry class is defined by Redmine, I had to monkey-patch that class. …