diff --git a/src/main/java/org/jlab/dtm/presentation/controller/operability/AnnualRepair.java b/src/main/java/org/jlab/dtm/presentation/controller/operability/AnnualRepair.java
index b41de27..6385550 100644
--- a/src/main/java/org/jlab/dtm/presentation/controller/operability/AnnualRepair.java
+++ b/src/main/java/org/jlab/dtm/presentation/controller/operability/AnnualRepair.java
@@ -11,14 +11,11 @@
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.jlab.dtm.business.service.AnnualRepairReportService;
+import org.jlab.dtm.business.session.CategoryFacade;
import org.jlab.dtm.business.session.CcAccHourService;
+import org.jlab.dtm.persistence.entity.Category;
import org.jlab.dtm.persistence.model.AnnualRepairReportRecord;
import org.jlab.dtm.presentation.util.DtmParamConverter;
import org.jlab.smoothness.business.util.TimeUtil;
@@ -33,6 +30,7 @@
public class AnnualRepair extends HttpServlet {
@EJB CcAccHourService accHourService;
+ @EJB CategoryFacade categoryFacade;
/**
* Handles the HTTP GET method.
@@ -54,6 +52,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
throw new ServletException("Unable to parse date", e);
}
+ String zeroDowntime = request.getParameter("zeroDowntime");
+
Calendar c = Calendar.getInstance();
// Date now = c.getTime();
c.set(Calendar.MILLISECOND, 0);
@@ -99,6 +99,31 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
try {
AnnualRepairReportService reportService = new AnnualRepairReportService();
recordList = reportService.find(start, end);
+
+ // Add in any categories (groups) that are missing as zero valued to explicitly celebrate
+ // they're zero
+ if ("hide".equals(zeroDowntime)) {
+ // Do nothing (if there was downtime in category, and it rounds down to zero percent, so
+ // be it)
+ // We could forcibly hide downtime that rounds to zero, but we don't right now.
+ } else { // show: forcibly show all categories, even if zero downtime
+ Date lastMonthStart = TimeUtil.startOfMonth(end, Calendar.getInstance());
+
+ List allAlphaCategoryList = categoryFacade.findAlphaCategoryList();
+ Set representedCategorySet = new HashSet<>();
+ for (AnnualRepairReportRecord record : recordList) {
+ representedCategorySet.add(record.getCategory());
+ }
+
+ for (Category cat : allAlphaCategoryList) {
+ if (!representedCategorySet.contains(cat.getName())) {
+ AnnualRepairReportRecord record =
+ new AnnualRepairReportRecord(
+ cat.getName(), cat.getCategoryId(), lastMonthStart, 0);
+ recordList.add(record);
+ }
+ }
+ }
} catch (SQLException e) {
throw new ServletException("Unable to query report database", e);
}
diff --git a/src/main/webapp/WEB-INF/views/operability/annual-repair.jsp b/src/main/webapp/WEB-INF/views/operability/annual-repair.jsp
index f843f35..111250e 100644
--- a/src/main/webapp/WEB-INF/views/operability/annual-repair.jsp
+++ b/src/main/webapp/WEB-INF/views/operability/annual-repair.jsp
@@ -63,7 +63,18 @@
-
+
+
+
+
+
+
+
+
+