Class ModuleProgress


  • @Entity
    public class ModuleProgress
    extends BaseTimestampedEntity
    This class represents state in which Module can be. This is used to determine how much user have listened. Also it hold information about current Unit.
    • Constructor Detail

      • ModuleProgress

        public ModuleProgress​(CommunityHealthWorker chw,
                              CourseModule courseModule)
        Create new Module Progress.
        Parameters:
        chw - CHW which progress will be stored
        courseModule - Module which progress will be stored
    • Method Detail

      • getCurrentUnitProgress

        public UnitProgress getCurrentUnitProgress()
      • isCompleted

        public boolean isCompleted()
      • calculateModuleStatus

        public void calculateModuleStatus​(java.time.LocalDateTime date,
                                          java.lang.Integer currentUnitNumber)
        Calculate module status. If module has not started the method sets it's status to in progress. If status is not completed and all unit progresses are completed then module status is also set to completed.
        Parameters:
        date - date of starting if the process has not started, in case of status is not completed ad all units status is completed date is ending date
        currentUnitNumber - number of currently processed unit
      • nextUnit

        public void nextUnit​(java.time.LocalDateTime endDate,
                             java.lang.Integer currentUnitNumber)
        Change current unit, if no more units change status to completed.
        Parameters:
        endDate - date of finish processing the unit
        currentUnitNumber - number of currently processed unit
      • isStarted

        public boolean isStarted()