For this reason, the report is heavily optimized.
Hash Arrays
Basically, all information about the business objects are pulled out of the database in a single SQL statement each and stored in a number of hash arrays for fast access. Hash arrays include:
- absences_hash(julian-uid) -> list of absence_type_id:
The list of all absences per day and user.
- assignment_hash(project_id-user_id) -> percentage
- cc_parent_hash(cost_center_id) -> parent cost_center_id
- collapse_hash(oid) -> "c" or "o":
Determines if the object has been "collapsed" or is "open"
- day_of_week_hash(julian) -> day_of_week (0..6):
Contains the day_of_week for all days in the reporting period.
- gif_hash(object_type) -> GIF HTML:
Holds HTML code to produce GIFs for each object type and a number of keywords (minus_9 plus_9 magnifier_zoom_in magnifier_zoom_out).
- main_project_hash(project_id) -> project_id:
The list of main projects (with parent_id=NULL)
- project_end_julian_hash(project_id) -> end julian
- project_level_hash(project_id) -> level
- project_parent_hash(project_id) -> parent project_id
- project_user_assignment_hash(project_id-uid) -> percentage:
Contains each individual assignment per task. This basic information needs to be aggregated up the project and department hierarchies.
- project_start_julian_hash(project_id) -> start julian
- object_availability_hash(oid) -> percentage:
The availability of an object. This is the im_employees.available_percent for users, or for departments the sum of availabilities of all users
- object_has_children_hash(oid) -> boolean
- object_name_hash(oid) -> object_name
- object_parent_hash(oid) -> parent oid:
Includes object-parent pairs for tasks and super tasks and cost centers and super cost centers. It also contains cost centers as the parent for a user. However, it does not contain any connection between projects and users, because one project may have "multiple parents" (users).
- object_type_hash(oid) -> object_type
- url_hash(object_type) -> url:
The base URL for each object type referenced in the report.
- user_hash(user_id) -> user_id:
The list of all users that are assigned to any project.
- start_of_week_julian_hash(julian) -> start_of_week julian
- user_department_hash(uid) -> cost_center_id
- weekend_hash(julian) -> absence_type_id
Dimensions and Aggregates
- assignment_hash(julian-project_id-user_id) -> aggregated percentage:
Includes absences as 100% assignments on top of project assignments.
- left_dimension:
A list of lists with the object_ids of parents for every user and cost center referenced.
- left_dimension_hash(project_id-user_id) -> left dimension:
asdf
- left_dimension_hash(user_id) -> left dimension:
The left dimension for a specific user
Todo
- Prio #3: unify the left_dimension_hash to include the left dimension for all objects.
- Prio #4: Add an option to determine per absence_type_id whether an absence should be included or not.
Currently weekends and bank holidays are excluded hard-coded, but no other absences.
- Prio #5: Extend the current fake "freelance department" with fake departments for employees without departments?
- Prio #6: Unify two calls to im_date_julian_to_components for the time axis