Catalogue Progress
Intro
Catalogue progress tracking relates to the fields completed in the elements within a catalogue. A catalogue's progress can be tracked across one of the following: an organisation, the departments in the organisation, and the individuals in the organisation.
Catalogue progress
When creating a catalogue, the creator admin chooses whether the progress is tracked to the organisation, departments or individuals
Tracking to an organisation
The current organisation is determined by the CurrentOrganisationHelper. This helper handles the setting and collection of the current organisation, also ensuring the authenticated user has access to the current organisation.
Switching organisations
A user can only change the current organisation using the front-end dropdown in the nav bar
Tracking to a department
The current department is determined by the CurrentDepartmentHelper. This helper handles the setting and collection of the current department, also ensuring that the authenticated user has access to the current department
Switching a department
A user can only change the current department using the department switcher available on the catalogues that track by department
Accessing current department on the front-end
The current department is shared to the front-end via the currentDepartment prop in the AppServiceProvider
Tracking to an individual
The current individual is determined by the CurrentIndividualHelper. This helper handles the setting and collection of the current user, also ensuring that the authenticated user has access to viewing an individual's catalogues
Switching an individual
A user can only change the current individual using the individual switcher available on the catalogues that track by individual
Accessing current individual on the front-end
The current individual is shared to the front-end via the currentIndividual prop in the AppServiceProvider
CatalogueProgressService
The CatalogueProgressService is responsible for calculating the progress of a catalogue. This service is used in the CatalogueProgressObserver to update the catalogue progress when a field is marked as complete.
Setting the current department and individual
The CatalogueProgressService uses the CurrentDepartmentHelper and CurrentIndividualHelper to determine the current department and individual respectively in the constructor. Once set in the constructor, the current department and individual is then used in all class methods to either set or update the catalogue progress based on the current department or individual values. When the current department or individual is not set, the service defaults to the organisation.
ApiElementFieldController
The ApiElementFieldController is responsible for handling the field progress data. This controller is used to collect and store field progress data. The controller has two methods: progress() and store(). The progress() method is used to collect existing field progress records, while the store() method is used to store new field progress records. Because the current department and individual are set in the CatalogueProgressService, the ApiElementFieldController can use the current department and individual values to determine the field progress records to collect or store.