From f71b0ecbc3931e4429ba6dbe4ffc4f48a05b21fd Mon Sep 17 00:00:00 2001
From: Carlos Vega <carlos.vega@uni.lu>
Date: Mon, 7 Jan 2019 15:26:24 +0100
Subject: [PATCH] added is_event_not_finished function to check the event
 status

---
 smash/web/static/js/daily_planning.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/smash/web/static/js/daily_planning.js b/smash/web/static/js/daily_planning.js
index 028a91b1..5590873b 100644
--- a/smash/web/static/js/daily_planning.js
+++ b/smash/web/static/js/daily_planning.js
@@ -311,6 +311,13 @@ function saveEvents(calendar_selector) {
     });
 }
 
+function is_event_not_finished(event){
+    if( event.status == undefined || event.status == 'SCHEDULED' ){
+        return true;
+    }else{
+        return false;
+    }
+}
 
 function addDailyPlanningCalendar(calendar_selector, replace_all, calendar_dict_props){
 
@@ -342,7 +349,9 @@ function addDailyPlanningCalendar(calendar_selector, replace_all, calendar_dict_
             click: function () {
                 calendarEvents = $(calendar_selector).fullCalendar('clientEvents');
                 $.each(calendarEvents, function (i, calendar_event) {
-                    remove_event(calendar_event);
+                    if(is_event_not_finished(calendar_event)){ //do not delete finished events
+                        remove_event(calendar_event);
+                    }
                 });
             }
         },
-- 
GitLab