summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/pracrodaopgsql.cc10
1 files 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);