Training Records View
URL: <base-url>/backend/hrc#/trainingrecords
Directory: VaahCms/Modules/HRC/Vue/pages/trainingrecords
Controller: VaahCms/Modules/HRC/Http/Controllers/Backend/TrainingRecordsController.php
Model: VaahCms/Modules/HRC/Models/EqTrainingRecord.php
Store: VaahCms/Modules/HRC/Vue/store/modules/store-trainingrecords.jsDescription
The training records view page displays the detailed view of the training records, so that users can analyze the performance of the record. The main feature of the page is that it allows to replay the training as if it was in real time.
Purpose
- To view previous training records
- To replay training records
- To show the location of the horse in map during the session
- The map must also display the racecourse with it's checkpoint markers
- Show vitals such as speed and heart rate on the chart.
- Should correctly identify whenever a marker is crossed
- User should be able to take text or audio notes
How it works?
Initial Load
onLoadmethod is called as soon as the page is loadedonLoadperforms the following- gets the active map id from the route params
- calls
getAssetsmethod - calls
getItemmethod
- The
getItemmethod fetches the training record with the EHM data - This initializes the map, sets active training center and timezone, then it calls the following
setMarkersAndPointers: to set markers and pointers to mapsetInitialSpeedUnit: to set the initial speed unit from sessionsetInitialData: to set the initial datagetTrainingSessionInfo: fetches additional training session infogetNotes: fetches notes of the training records
When player is started
- When play button is pressed
startTrainingRecordis called on click. - This basically clears any unwanted data and calls
refreshPlayer() - This basically starts a loop from the index set for current index and calls
playTrainingRecordsmethod on each loop. playTrainingRecordsmimics live preview at a regular interval defined in data It takes an index as a parameter and plays training records by manipulating the data in the component's state.
The function first checks if the index is greater than the ending index of the records, and if so, it stops playing the records. Then, it gets the data at the specified index and applies some transformations to it. If latitude and longitude values exist in the data, they are converted to decimal degrees. The function also updates distance variables using the new data.
If the data contains parsed coordinates, it updates the map's center and initializes it. The data is then added to the training data array, and additional data fields are added using a helper function. The delay is calculated in seconds, and the new data is added to the chart.
Assumptions
- Training record is synced
Acceptance Criteria
- By default it must show all ehm record
- Page should not take more than 2 seconds to load
- All notes should be accessible
- Ability to zoom from chart
- When play button is pressed, it should mimic live preview
- Player speed can be changed.