From e3da2285d244b87d81a9dc79d2ce2e3e72e9e5d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn=20K=C3=BCnsem=C3=B6ller?=
 <jkuensem@physik.uni-bielefeld.de>
Date: Thu, 7 Oct 2021 10:22:24 +0200
Subject: [PATCH] TMSS-159: change reference time in MACscheduler back to
 scheduled_on_sky

---
 MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc | 4 ++--
 MAC/APL/MainCU/src/MACScheduler/TMSSBridge.cc   | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
index cfa73e2eb20..b1a3291432c 100644
--- a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
@@ -797,7 +797,7 @@ void MACScheduler::_updatePlannedList()
 
 	if (!upcomingSubTasks.empty()) {
 		LOG_DEBUG(formatString("TMSSCheck:First planned observation (%s) is at %s",
-				upcomingSubTasks[0]["url"].asCString(), upcomingSubTasks[0]["scheduled_process_start_time"].asCString()));
+				upcomingSubTasks[0]["url"].asCString(), upcomingSubTasks[0]["scheduled_on_sky_start_time"].asCString()));
 	}
 
 	// make a copy of the current prepared observations (= observations shown in the navigator in the 'future'
@@ -913,7 +913,7 @@ void MACScheduler::_updatePlannedList()
 
 		// construct name and timings info for observation
 		string obsName(observationName(subtask_id));
-		ptime  start_time = time_from_string(subtask["scheduled_process_start_time"].asString().replace(10, 1, " "));
+		ptime  start_time = time_from_string(subtask["scheduled_on_sky_start_time"].asString().replace(10, 1, " "));
 		ptime  modTime = time_from_string(subtask["updated_at"].asString().replace(10, 1, " "));
 
 		// remove obs from backup of the planned-list (it is in the list again)
diff --git a/MAC/APL/MainCU/src/MACScheduler/TMSSBridge.cc b/MAC/APL/MainCU/src/MACScheduler/TMSSBridge.cc
index c1d7f1bb912..b0d0e6e2c0f 100644
--- a/MAC/APL/MainCU/src/MACScheduler/TMSSBridge.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/TMSSBridge.cc
@@ -83,7 +83,7 @@ Json::Value TMSSBridge::getSubTasksStartingInThreeMinutes()
 	ptime	upper_limit = from_time_t(now+3*60);
 
     //TODO: make exact query as in SAS/OTDB/sql/getTreeGroup_func.sql with OR'd states and exact timewindow
-    string queryStr = "/api/subtask/?state__value=scheduled&scheduled_process_start_time__gt=" + to_iso_extended_string(lower_limit) + "&scheduled_process_start_time__lt=" + to_iso_extended_string(upper_limit) + "&ordering=scheduled_process_start_time";
+    string queryStr = "/api/subtask/?state__value=scheduled&scheduled_on_sky_start_time__gt=" + to_iso_extended_string(lower_limit) + "&scheduled_on_sky_start_time__lt=" + to_iso_extended_string(upper_limit) + "&ordering=scheduled_on_sky_start_time";
 
     Json::Value result;
     if(httpGETAsJson(queryStr, result))
@@ -95,7 +95,7 @@ Json::Value TMSSBridge::getActiveSubTasks()
 {
 	ptime now = from_time_t(time(0));
     //TODO: make exact query as in SAS/OTDB/sql/getTreeGroup_func.sql with OR'd states and exact timewindow
-    string queryStr = "/api/subtask/?state__value=started&scheduled_process_start_time__lt=" + to_iso_extended_string(now) + "&scheduled_process_stop_time__gt=" + to_iso_extended_string(now) + "&ordering=scheduled_process_start_time";
+    string queryStr = "/api/subtask/?state__value=started&scheduled_on_sky_start_time__lt=" + to_iso_extended_string(now) + "&scheduled_on_sky_stop_time__gt=" + to_iso_extended_string(now) + "&ordering=scheduled_on_sky_start_time";
 
     Json::Value result;
     if(httpGETAsJson(queryStr, result))
@@ -107,7 +107,7 @@ Json::Value TMSSBridge::getFinishingSubTasks()
 {
 	ptime justnow = from_time_t(time(0)-3*60);
     //TODO: make exact query as in SAS/OTDB/sql/getTreeGroup_func.sql with OR'd states and exact timewindow
-    string queryStr = "/api/subtask/?state__value=finishing&scheduled_process_stop_time__gt=" + to_iso_extended_string(justnow) + "&ordering=scheduled_process_start_time";
+    string queryStr = "/api/subtask/?state__value=finishing&scheduled_on_sky_stop_time__gt=" + to_iso_extended_string(justnow) + "&ordering=scheduled_on_sky_start_time";
 
     Json::Value result;
     if(httpGETAsJson(queryStr, result))
@@ -161,7 +161,7 @@ std::size_t callback(const char* in,
 // Need to check response status code of http (200)
 // Inspired by https://gist.github.com/connormanning/41efa6075515019e499c
 // Example:
-//    httpQuery("/api/subtask/?scheduled_process_start_time__lt=2020-03-04T12:03:00")
+//    httpQuery("/api/subtask/?scheduled_on_sky_start_time__lt=2020-03-04T12:03:00")
 //    results in a json string output
 //
 bool TMSSBridge::httpQuery(const string& target, string &result, const string& query_method, const string& data)
-- 
GitLab