Skip to content

Commit

Permalink
Possible downtime vs program time
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
slominskir committed Apr 8, 2024
1 parent 8d7701e commit 4e65260
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ public void setAccSeconds(Integer accSeconds) {
public Integer calculateProgramSeconds() {
return restoreSeconds + accSeconds + upSeconds + studiesSeconds + downSeconds;
}

public Integer calculatePossibleDowntimeSeconds() {
return upSeconds + downSeconds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,22 @@
*/
public class CcDowntimeCrossCheck {

private static final int TEN_MINUTES_OF_SECONDS = 600;

private final boolean passed;
private final boolean lowProgramPassed;
private final boolean lowDownHardPassed;

private final String lowProgramMessage;
private final String lowDownHardMessage;

public CcDowntimeCrossCheck(CcAccShiftTotals acc, long dtmEventDownSeconds) {

int programSeconds = acc.getUpSeconds() + acc.getDownSeconds() + acc.getRestoreSeconds() + acc.getStudiesSeconds() + acc.getAccSeconds();
int possibleDowntimeSeconds = acc.calculatePossibleDowntimeSeconds();

lowProgramMessage = "DTM event down (" + BtmFunctions.formatDuration((int) dtmEventDownSeconds, DurationUnits.HOURS) + " hours) is greater than BTM program time [PHYSICS + STUDIES + RESTORE + ACC + DOWN] (" + BtmFunctions.formatDuration(programSeconds, DurationUnits.HOURS) + " hours)";
lowDownHardMessage = "";
lowProgramMessage = "DTM event down (" + BtmFunctions.formatDuration((int) dtmEventDownSeconds, DurationUnits.HOURS) + " hours) is significantly greater than BTM possible down time [PHYSICS + INTERNAL DOWN] (" + BtmFunctions.formatDuration(possibleDowntimeSeconds, DurationUnits.HOURS) + " hours)";

lowProgramPassed = programSeconds >= dtmEventDownSeconds;
lowDownHardPassed = true;
lowProgramPassed = possibleDowntimeSeconds >= dtmEventDownSeconds - TEN_MINUTES_OF_SECONDS;

passed = lowProgramPassed && lowDownHardPassed;
passed = lowProgramPassed;
}

public boolean isPassed() {
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/WEB-INF/includes/cross-check-panel.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
</ul>
<div id="cross-check-summary-tab" data-signature="${fn:length(signatureList) > 0}">
<div id="cross-check-summary-panel">
<h5>DTM vs BTM</h5>
<h5>BTM vs DTM</h5>
<table id="dtm-btm-table" class="data-table">
<thead>
<tr>
<th>BTM Program</th>
<th>DTM Event</th>
<th>BTM Possible Downtime</th>
<th>DTM Event Downtime</th>
<th>Cross Check Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>${btm:formatDurationLossy(accAvailability.shiftTotals.calculateProgramSeconds(), durationUnits)}</td>
<td>${btm:formatDurationLossy(accAvailability.shiftTotals.calculatePossibleDowntimeSeconds(), durationUnits)}</td>
<td>${btm:formatDurationLossy(dtmTotals.eventSeconds, durationUnits)}</td>
<td class="${downCrossCheck.isPassed() ? '' : 'ui-state-error'}">${downCrossCheck.isPassed() ? '' : 'X'}</td>
</tr>
Expand Down

0 comments on commit 4e65260

Please sign in to comment.