From a949a28ef255983bf1b3b52eb90f1859240a897b Mon Sep 17 00:00:00 2001
From: deva <deva>
Date: Fri, 10 Jun 2011 06:38:09 +0000
Subject: Disable timeouts of resumes created in current session.

---
 server/src/pracrodaopgsql.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc
index d3ae8df..774fb0c 100644
--- a/server/src/pracrodaopgsql.cc
+++ b/server/src/pracrodaopgsql.cc
@@ -278,9 +278,10 @@ Values PracroDAOPgsql::getLatestValues(std::string sessionid,
       " (SELECT f.name, MAX(t.timestamp) AS ts "
       "   FROM commits c, fields f, transactions t "
       "   WHERE ";
-    if(!uncom) query += "(c.status='committed' OR c.uid="+sessionid+") AND ";
+    //if(!uncom) query += "(c.status='committed' OR c.uid="+sessionid+") AND ";
+    if(!uncom) query += "((c.status='committed' AND t.timestamp >= " + soldest.str() + ") OR c.uid="+sessionid+") AND ";
     query += "c.uid = t.cid AND t.uid = f.transaction"
-      " AND t.timestamp >= " + soldest.str() +
+      // " AND t.timestamp >= " + soldest.str() +
       " AND c.patientid = '" + W.esc(patientid) + "' "
       + namecond;
     if(macro) {
@@ -341,9 +342,10 @@ unsigned PracroDAOPgsql::nrOfCommits(std::string sessionid,
     pqxx::work W(*conn);
     query = "SELECT count(*) FROM commits c, transactions f"
       " WHERE c.patientid = '" + W.esc(patientid) + "' AND c.uid = f.cid";
-    if(!uncom) query += " AND (c.status='committed' OR c.uid="+sessionid+")";
+    //if(!uncom) query += " AND (c.status='committed' OR c.uid="+sessionid+")";
+    if(!uncom) query += " AND ((c.status='committed' AND f.timestamp >= " + soldest.str() + ") OR c.uid="+sessionid+")";
     query += " AND f.macro = '" + W.esc(macroname) + "' "
-      " AND f.timestamp >= " + soldest.str()
+      //" AND f.timestamp >= " + soldest.str()
       ;
     DEBUG(sql, "Query: %s\n", query.c_str());
     pqxx::result R = W.exec(query);
-- 
cgit v1.2.3