Skip to content

Commit

Permalink
When you open the edit page for a scheduled task, if you leave the page
Browse files Browse the repository at this point in the history
without saving, the repeat interval unit gets changed to seconds no
matter what it was previously - TRUNK-3759(cherry picked from commit ac9bb64)
  • Loading branch information
wluyima authored and dkayiwa committed Mar 1, 2013
1 parent aaee716 commit 945d5c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Expand Up @@ -183,20 +183,22 @@ protected Map<String, String> referenceData(HttpServletRequest request, Object c
TaskDefinition task = (TaskDefinition) command;

Long interval = task.getRepeatInterval();

if (interval == null || interval < 60)
Long repeatInterval;
if (interval == null || interval < 60) {
map.put("units", "seconds");
else if (interval < 3600) {
repeatInterval = interval;
} else if (interval < 3600) {
map.put("units", "minutes");
task.setRepeatInterval(interval / 60);
repeatInterval = interval / 60;
} else if (interval < 86400) {
map.put("units", "hours");
task.setRepeatInterval(interval / 3600);
repeatInterval = interval / 3600;
} else {
map.put("units", "days");
task.setRepeatInterval(interval / 86400);
repeatInterval = interval / 86400;
}

map.put("repeatInterval", repeatInterval.toString());
return map;
}

Expand Down
Expand Up @@ -276,7 +276,7 @@ window.onload = init;
<td valign="top"><openmrs:message code="Scheduler.scheduleForm.repeatInterval"/>:</td>
<td>
<spring:bind path="task.repeatInterval">
<input type="text" id="repeatInterval" name="repeatInterval" size="10" value="${status.value}" />
<input type="text" id="repeatInterval" name="repeatInterval" size="10" value="${repeatInterval}" />
<select name="repeatIntervalUnits">
<option value="seconds" <c:if test="${units=='seconds'}">selected</c:if>><openmrs:message code="Scheduler.scheduleForm.repeatInterval.units.seconds" /></option>
<option value="minutes" <c:if test="${units=='minutes'}">selected</c:if>><openmrs:message code="Scheduler.scheduleForm.repeatInterval.units.minutes" /></option>
Expand Down

0 comments on commit 945d5c6

Please sign in to comment.