Module: Backlogs::QueryPatch
- Defined in:
- lib/backlogs_query_patch.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary (collapse)
-
+ (Object) included(base)
:nodoc:.
Class Method Details
+ (Object) included(base)
:nodoc:
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/backlogs_query_patch.rb', line 16 def self.included(base) # :nodoc: base.extend(ClassMethods) base.send(:include, InstanceMethods) # Same as typing in the class base.class_eval do unloadable # Send unloadable so it will not be unloaded in development base.add_available_column(QueryColumn.new(:story_points, :sortable => "#{Issue.table_name}.story_points")) base.add_available_column(QueryColumn.new(:velocity_based_estimate)) # couldn't get HAVING to work, so a subselect will have to # do story_sql = "from issues story where story.root_id = issues.root_id and story.lft in ( select max(story_lft.lft) from issues story_lft where story_lft.root_id = issues.root_id and story_lft.tracker_id in (<%= RbStory.trackers(:string) %>) and issues.lft >= story_lft.lft and issues.rgt <= story_lft.rgt )" base.add_available_column(QueryColumn.new(:position, :sortable => [ # sprint startdate "coalesce((select sprint_start_date from versions where versions.id = issues.fixed_version_id), '1900-01-01')", # sprint id, in case start dates are the same "(select id from versions where versions.id = issues.fixed_version_id)", # make sure stories with NULL position sort-last RbERB.new("(select case when story.position is null then 1 else 0 end #{story_sql})"), # story position RbERB.new("(select story.position #{story_sql})"), # story ID, in case story positions are the same (SHOULD NOT HAPPEN!). RbERB.new("(select story.id #{story_sql})"), # order in task tree "issues.lft" ], :default_order => 'asc')) base.add_available_column(QueryColumn.new(:remaining_hours)) alias_method_chain :available_filters, :backlogs_issue_type alias_method_chain :sql_for_field, :backlogs_issue_type end end |