app/controllers/work_accounts_controller.rb in backlog-0.22.1 vs app/controllers/work_accounts_controller.rb in backlog-0.23.0

- old
+ new

@@ -17,10 +17,11 @@ works = @work_account.works.select{|w|w.user_id == current_user.id} @backlog_totals = works.to_summarized_hash {|work| [work.task && work.task.backlog, work.hours]} @task_totals = works.to_summarized_hash {|work| [work.task, work.hours]} @task_totals_per_backlog = @task_totals.to_a.to_grouped_hash {|task, hours| [task && task.backlog, [task, hours]]} @total_hours = works.inject(BigDecimal('0')) {|total, work| total += work.hours} + @works_without_backlog = works.select {|w| w.task_id.nil?} end def new @work_account = WorkAccount.new end @@ -51,6 +52,19 @@ def destroy WorkAccount.find(params[:id]).destroy redirect_to :action => 'list' end + + def works + work_account = WorkAccount.find(params[:id]) + @report_filter = ReportFilter.new(params[:report_filter]) + @report_filter.title = "#{l :hours} for #{work_account.name} #{@report_filter.start_on && @report_filter.start_on.strftime('%Y-%m-%d - ')}#{@report_filter.end_on && @report_filter.end_on.strftime('%Y-%m-%d')}" + @works = Work.paginate :conditions => ["completed_at BETWEEN ? AND ? AND work_account_id = ?", @report_filter.start_on, @report_filter.end_on, work_account.id], :page => params[:page], :per_page => @report_filter.page_size + if params[:export] == 'excel' + render :template => '/works/list_excel', :layout => false + else + render :template => '/works/list' + end + end + end