Fix problem with monospace font
[proteocache.git] / server / compbio / controllers / DailyStatisticsController.java
index 403c220..1453523 100644 (file)
@@ -19,21 +19,26 @@ import compbio.beans.Total;
 import compbio.cassandra.readers.CassandraReader;
 import compbio.cassandra.readers.DailyStatisticsReader;
 
-
 /**
+ * MVC controller for collecting and showing job statistics
+ * 
  * @author Alexander Sherstnev
  * @author Natasha Sherstneva
- * @version 1.0 Dec 2013
+ * 
+ * @version 1.0
+ * @since Dec 2013
  */
 @Controller
 public class DailyStatisticsController extends BasicController {
 
        /**
-        * form a query page for daily job statistics. The servlet should be
-        * available for users and admins only. By defaults the report time range is
-        * from the earliest day with jobs to today ("Query for all dates" is
-        * ticked). If the user removes the tick the time range is from today - 3
-        * days to today. Currently, the input model is empty.
+        * form a query page for daily job statistics.
+        * 
+        * The servlet should be available for users and admins only. By defaults
+        * the report time range is from the earliest day with jobs to current date
+        * ("Query for all dates" is ticked). If the user removes the tick the time
+        * range is from today - 3 days to today. Currently, the input model is
+        * empty.
         * 
         * @param model
         *            MVC model
@@ -75,8 +80,8 @@ public class DailyStatisticsController extends BasicController {
                final long startTime = System.currentTimeMillis();
                DailyStatisticsReader reader = new DailyStatisticsReader();
                if (option.equals("AllDates,off")) {
-                       date1 = theEaerlistDate;
-                       date2 = theCurrentDate;
+                       date1 = getEarliestDate();
+                       date2 = getCurrentDate();
                }
 
                // dates in string format
@@ -85,7 +90,7 @@ public class DailyStatisticsController extends BasicController {
                // dates in long format
                long longDate1 = DateFormatter.DateParsing(date1, formaterYYMMDD);
                long longDate2 = DateFormatter.DateParsing(date2, formaterYYMMDD);
-               String error = DateChecking(trimmeddate1, trimmeddate2, longDate1, longDate2);
+               String error = checkDates(trimmeddate1, trimmeddate2, longDate1, longDate2);
                if (error != null) {
                        model.put("error", error);
                        model.put("date1", date1);
@@ -116,7 +121,7 @@ public class DailyStatisticsController extends BasicController {
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
                model.put("option", option);
-               return "/reportJobStatistics";
+               return "reports/JobStatistics";
        }
 
        /**
@@ -149,10 +154,9 @@ public class DailyStatisticsController extends BasicController {
                        realdate = date;
                        thetime = formaterDDMMYY.parse(realdate).getTime();
                }
-               
-               if (null == JobStatus.getJobStatus(status)) {
+
+               if (null == JobStatus.getJobStatus(status))
                        return "support/Notimplemented";
-               }
 
                DailyStatisticsReader reader = new DailyStatisticsReader();
                // IMPORTANT: input should be suppied in the format: DD/MM/YYYY
@@ -164,6 +168,6 @@ public class DailyStatisticsController extends BasicController {
                model.put("status", status);
                final long endTime = System.currentTimeMillis();
                model.put("timeExecution", (endTime - startTime));
-               return "/reportJobStatisticsOneDay";
+               return "reports/JobStatisticsOneDay";
        }
 }