Store information about a specific task over a column’s date range.
The object does not store the task or range data since this would be redundant across potentially numerous instances leading to significant RAM wastage. Instead:
The ReportCell objects are stored in a ReportRow “cells” array. The array indices correspond directly to array indices of the Report’s “ranges” array, compiled as the first row of the report gets built.
The ReportRows’ “task” property gives the task object for that row.
So - to find task and range, you need to know the row index of the ReportRow and the column index of the ReportCell this contains.
User breakdown for this cell
# File lib/track_record_report.rb, line 1112 def initialize() super() @user_data = [] end
Add the given ReportUserData object to the “@#user_data” array and add it to the internal running hourly count.
# File lib/track_record_report.rb, line 1120 def add_user_data( data ) @user_data.push( data ) add!( data ) end
Pass a date range, an array of committed work packets sorted by date descending, an array of not committed work packets sorted by date descending and an optional user IDs array. Hours are summed for work packets across the given range. Any work packets falling within the range are removed from the arrays. Separate totals for each of the users in the given array are maintained in the @#user_data array.
# File lib/track_record_report.rb, line 1132 def calculate!( range, committed, not_committed, reportable_user_ids = [] ) # Reset internal calculations and pre-allocate ReportUserData objects for # each user (if any). reset!() @user_data = [] reportable_user_ids.each_index do | user_index | @user_data[ user_index ]= ReportUserData.new end # Start and the end of the committed packets array. For anything within # the given range, add the hours to the internal total and add to the # relevant user @committed = sum( range, committed, reportable_user_ids, :add_committed_hours ) # Same again, but for not committed hours. @not_committed = sum( range, not_committed, reportable_user_ids, :add_not_committed_hours ) end