From 1a6b4f8d82c0ac2fbd16df20a2d851fa3359b5eb Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jordan=20Aug=C3=A9?= <jordan.auge@lip6.fr>
Date: Mon, 21 Jul 2014 10:53:17 +0200
Subject: [PATCH] fixed scheduler

---
 manifoldapi/static/js/manifold.js            | 12 ++++++++++--
 plugins/scheduler2/static/css/scheduler2.css |  4 ++--
 portal/homeview.py                           |  1 +
 portal/sliceresourceview.py                  |  2 ++
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js
index b959c10e..7dfcb4db 100644
--- a/manifoldapi/static/js/manifold.js
+++ b/manifoldapi/static/js/manifold.js
@@ -1302,7 +1302,7 @@ case TYPE_LIST_OF_VALUES:
                 */
                 case TYPE_LIST_OF_VALUES: // XXX Until fixed
                 case TYPE_LIST_OF_RECORDS:
-                    var new_state,cur_query_uuid;
+                    var key, new_state, cur_query_uuid;
 
                     cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
 
@@ -1310,7 +1310,15 @@ case TYPE_LIST_OF_VALUES:
                     //  - update_query_orig.params.resource = resources in slice before update
                     //  - update_query.params.resource = resource requested in slice
                     //  - keys from field = resources obtained
-                    var key = manifold.metadata.get_key(field);
+                
+                    if (field == 'lease') {
+                         // lease_id has been added to be repeated when
+                         // constructing request rspec. We don't want it for
+                         // comparisons
+                        key = ['start_time', 'end_time', 'resource'];
+                    } else {
+                        key = manifold.metadata.get_key(field);
+                    }
                     if (!key)
                         continue;
                     /*
diff --git a/plugins/scheduler2/static/css/scheduler2.css b/plugins/scheduler2/static/css/scheduler2.css
index 2fcf0634..cda74b12 100755
--- a/plugins/scheduler2/static/css/scheduler2.css
+++ b/plugins/scheduler2/static/css/scheduler2.css
@@ -220,10 +220,10 @@
     cursor: not-allowed;
 }
 
-#scheduler-reservation-table tbody tr td.success {
+#scheduler-reservation-table tbody tr td.success:after {
 	content: "✓";
 }
-#scheduler-reservation-table tbody tr td.failure {
+#scheduler-reservation-table tbody tr td.failure:after {
 	content: "✗";
 }
 
diff --git a/portal/homeview.py b/portal/homeview.py
index d46ed651..45764319 100644
--- a/portal/homeview.py
+++ b/portal/homeview.py
@@ -101,6 +101,7 @@ class HomeView (FreeAccessView, ThemeView):
             ## check user is pi or not
             platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
             account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
+            # XXX Something like an invalid session seems to make the execute fail sometimes, and thus gives an error on the main page
             platform_details = execute_query(self.request, platform_query)
             account_details = execute_query(self.request, account_query)
             for platform_detail in platform_details:
diff --git a/portal/sliceresourceview.py b/portal/sliceresourceview.py
index db72dca9..db7413d1 100644
--- a/portal/sliceresourceview.py
+++ b/portal/sliceresourceview.py
@@ -256,6 +256,8 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
         platform_details = execute_query(self.request, platform_query)
         account_details = execute_query(self.request, account_query)
+
+        # XXX When session has expired, this is None and thus not iterable
         for platform_detail in platform_details:
             for account_detail in account_details:
                 if platform_detail['platform_id'] == account_detail['platform_id']:
-- 
2.47.0