fixed display of third party leases
authorJordan Augé <jordan.auge@lip6.fr>
Fri, 11 Jul 2014 09:32:08 +0000 (11:32 +0200)
committerJordan Augé <jordan.auge@lip6.fr>
Fri, 11 Jul 2014 09:32:08 +0000 (11:32 +0200)
plugins/scheduler2/static/js/scheduler2.js

index 0150830..102c456 100755 (executable)
@@ -682,7 +682,7 @@ var SCHEDULER_COLWIDTH = 50;
 \r
                 resource = this.scope_resources_by_key[lease.resource];\r
                 day_timestamp = SchedulerDateSelected.getTime() / 1000;\r
-                id_start = (lease.start_time - day_timestamp) / resource.granularity;\r
+                id_start = Math.floor((lease.start_time - day_timestamp) / resource.granularity);\r
 \r
                 /* Some leases might be in the past */\r
                 if (id_start < 0)\r
@@ -691,14 +691,14 @@ var SCHEDULER_COLWIDTH = 50;
                 if (id_start >= this._all_slots.length)\r
                     return true; // ~ continue\r
 \r
-                id_end   = (lease.end_time   - day_timestamp) / resource.granularity - 1;\r
+                id_end   = Math.ceil((lease.end_time   - day_timestamp) / resource.granularity);\r
                 colspan_lease = resource.granularity / this._granularity; //eg. 3600 / 1800 => 2 cells\r
                 if (id_end >= this._all_slots.length / colspan_lease) {\r
                     /* Limit the display to the current day */\r
                     id_end = this._all_slots.length / colspan_lease\r
                 }\r
 \r
-                for (i = id_start; i <= id_end; i++) {\r
+                for (i = id_start; i < id_end; i++) {\r
                     // the same slots might be affected multiple times.\r
                     // PENDING_IN + PENDING_OUT => IN \r
                     //\r