var cached_headings
var all_fetched;
+// Force a minimum start date for new headings to avoid reporting on
+// (practically) all headings, which occurs when the start date preceeds
+// or includes the SQL deployment date, which stamps a create_date on
+// every heading to NOW(). Such queries cause heavy load and eventually
+// time out anyway.
+// NOTE: using English dates instead of ISO dates since English
+// dates tell Date.parse() to use the local time zone instead of UTC.
+var min_start_date = new Date(Date.parse('December 5, 2016 00:00:00'));
+
var summary_fields = [
'prev_entry_value',
'entry_value',
start_date = startDate.attr('value');
end_date = endDate.attr('value');
- if (start_date) {
- start_date = openils.Util.getYMD(start_date);
+ if (!start_date || start_date < min_start_date) {
+ console.log("Selected start date " + start_date + " is too early. "
+ + "Using min start date " + min_start_date + " instead");
+
+ // clone the date since it will get clobbered by getYMD.
+ startDate.attr('value', min_start_date);
+ start_date = min_start_date;
}
+ start_date = openils.Util.getYMD(start_date);
+
if (end_date) {
// the end date has to be extended by one day, since the between
// query cuts off at midnight (0 hour) on the end date, which