Skip to content
Snippets Groups Projects
Commit ca842b58 authored by srosse's avatar srosse
Browse files

OO-1349: start thicker at x:01 instead of x:55, check for leading time changeing status

parent 09d0432e
No related branches found
No related tags found
No related merge requests found
...@@ -1341,12 +1341,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo ...@@ -1341,12 +1341,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo
lockMode = mode; lockMode = mode;
lockStatus = LockStatus.need; lockStatus = LockStatus.need;
} else if(lockResource != null && lockResource.getResourceableId().equals(mode.getResource().getResourceableId())) { } else if(lockResource != null && lockResource.getResourceableId().equals(mode.getResource().getResourceableId())) {
if(mode.getStatus() == Status.leadtime) { if(mode.getStatus() == Status.leadtime || mode.getStatus() == Status.followup) {
if(assessmentGuardCtrl == null) {
lockStatus = LockStatus.need;
}
lockMode = mode;
} else if(mode.getStatus() == Status.followup) {
if(assessmentGuardCtrl == null) { if(assessmentGuardCtrl == null) {
lockStatus = LockStatus.need; lockStatus = LockStatus.need;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<bean id="assessmentNotificationsTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <bean id="assessmentNotificationsTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="assessmentNotificationsJob" /> <property name="jobDetail" ref="assessmentNotificationsJob" />
<property name="cronExpression" value="55 * * * * ?" /> <property name="cronExpression" value="1 * * * * ?" />
<property name="startDelay" value="55000" /> <property name="startDelay" value="55000" />
</bean> </bean>
......
...@@ -57,20 +57,14 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor ...@@ -57,20 +57,14 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor
for(AssessmentMode currentMode:currentModes) { for(AssessmentMode currentMode:currentModes) {
sendEvent(currentMode, now, false); sendEvent(currentMode, now, false);
} }
System.out.println("Beat: " + now() + " and " + new Date());
} }
private Date now() { private Date now() {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
//round to minute
cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.MILLISECOND, 0);
int second = cal.get(Calendar.SECOND); cal.set(Calendar.SECOND, 0);
if(second > 30) {
//round to the next minute
cal.set(Calendar.SECOND, 0);
cal.add(Calendar.MINUTE, 1);
} else {
cal.set(Calendar.SECOND, 0);
}
return cal.getTime(); return cal.getTime();
} }
...@@ -90,7 +84,7 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor ...@@ -90,7 +84,7 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor
Date endWithFollowupTime = assessmentModeManager.evaluateFollowupTime(end, followup); Date endWithFollowupTime = assessmentModeManager.evaluateFollowupTime(end, followup);
if(beginWithLeadTime.compareTo(now) > 0) { if(beginWithLeadTime.compareTo(now) > 0) {
status = Status.none; status = Status.none;
} else if(beginWithLeadTime.compareTo(now) <= 0 && begin.compareTo(now) >= 0) { } else if(beginWithLeadTime.compareTo(now) <= 0 && begin.compareTo(now) >= 0 && !beginWithLeadTime.equals(begin)) {
status = Status.leadtime; status = Status.leadtime;
} else if(begin.compareTo(now) <= 0 && end.compareTo(now) >= 0) { } else if(begin.compareTo(now) <= 0 && end.compareTo(now) >= 0) {
status = Status.assessment; status = Status.assessment;
...@@ -114,7 +108,8 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor ...@@ -114,7 +108,8 @@ public class AssessmentModeCoordinationServiceImpl implements AssessmentModeCoor
mode = ensureStatusOfMode(mode, Status.none); mode = ensureStatusOfMode(mode, Status.none);
sendEvent(AssessmentModeNotificationEvent.BEFORE, mode, sendEvent(AssessmentModeNotificationEvent.BEFORE, mode,
assessmentModeManager.getAssessedIdentityKeys(mode)); assessmentModeManager.getAssessedIdentityKeys(mode));
} else if(mode.getBeginWithLeadTime().compareTo(now) <= 0 && mode.getBegin().compareTo(now) >= 0) { } else if(mode.getBeginWithLeadTime().compareTo(now) <= 0 && mode.getBegin().compareTo(now) >= 0
&& mode.getBeginWithLeadTime().compareTo(mode.getBegin()) != 0) {
mode = ensureStatusOfMode(mode, Status.leadtime); mode = ensureStatusOfMode(mode, Status.leadtime);
sendEvent(AssessmentModeNotificationEvent.LEADTIME, mode, sendEvent(AssessmentModeNotificationEvent.LEADTIME, mode,
assessmentModeManager.getAssessedIdentityKeys(mode)); assessmentModeManager.getAssessedIdentityKeys(mode));
......
...@@ -136,9 +136,11 @@ public class AssessmentModeGuardController extends BasicController implements Ge ...@@ -136,9 +136,11 @@ public class AssessmentModeGuardController extends BasicController implements Ge
private void syncAssessmentModes(UserRequest ureq) { private void syncAssessmentModes(UserRequest ureq) {
List<ResourceGuard> modeWrappers = new ArrayList<ResourceGuard>(); List<ResourceGuard> modeWrappers = new ArrayList<ResourceGuard>();
for(TransientAssessmentMode mode:modes) { for(TransientAssessmentMode mode:modes) {
ResourceGuard wrapper = syncAssessmentMode(ureq, mode); if(mode != null) {
if(wrapper != null) { ResourceGuard wrapper = syncAssessmentMode(ureq, mode);
modeWrappers.add(wrapper); if(wrapper != null) {
modeWrappers.add(wrapper);
}
} }
} }
guards.setList(modeWrappers); guards.setList(modeWrappers);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment