Package org.motechproject.mots.domain
Class ModuleProgress
- java.lang.Object
-
- org.motechproject.mots.domain.BaseEntity
-
- org.motechproject.mots.domain.BaseTimestampedEntity
-
- org.motechproject.mots.domain.ModuleProgress
-
@Entity public class ModuleProgress extends BaseTimestampedEntity
-
-
Constructor Summary
Constructors Constructor Description ModuleProgress(CommunityHealthWorker chw, CourseModule courseModule)
Create new Module Progress.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calculateModuleStatus(java.time.LocalDateTime date, java.lang.Integer currentUnitNumber)
Calculate module status.UnitProgress
getCurrentUnitProgress()
boolean
isCompleted()
boolean
isStarted()
void
nextUnit(java.time.LocalDateTime endDate, java.lang.Integer currentUnitNumber)
Change current unit, if no more units change status to completed.
-
-
-
Constructor Detail
-
ModuleProgress
public ModuleProgress(CommunityHealthWorker chw, CourseModule courseModule)
Create new Module Progress.- Parameters:
chw
- CHW which progress will be storedcourseModule
- 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 datecurrentUnitNumber
- 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 unitcurrentUnitNumber
- number of currently processed unit
-
isStarted
public boolean isStarted()
-
-