From ef8ca720c38d91e9892eb3ed85f4b7d459d43b83 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 12 Nov 2009 12:02:41 +0000 Subject: Fixed missing macro check. --- server/src/pracrodaotest.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/pracrodaotest.cc b/server/src/pracrodaotest.cc index d6a0e1f..86e5941 100644 --- a/server/src/pracrodaotest.cc +++ b/server/src/pracrodaotest.cc @@ -106,9 +106,10 @@ void PracroDAOTest::commitTransaction(std::string user, std::string patientid, Values PracroDAOTest::getLatestValues(std::string patientid, Macro *macro, Fieldnames &fieldnames, time_t oldest) { + std::string macro_name = macro ? macro->attributes["name"].c_str() : "(null)"; PRACRO_DEBUG(db, "(%s, %s, <%u fieldnames>, %ld)\n", patientid.c_str(), - macro ? macro->attributes["name"].c_str() : "(null)", fieldnames.size(), + macro_name.c_str(), fieldnames.size(), oldest); Values values; @@ -124,7 +125,7 @@ Values PracroDAOTest::getLatestValues(std::string patientid, Macro *macro, while(ti != data.transactions.end()) { std::map &transaction = *ti; time_t timestamp = atol(transaction["timestamp"].c_str()); - if(transaction["patientid"] == patientid && timestamp >= oldest) { + if(transaction["patientid"] == patientid && timestamp >= oldest && (transaction["macro"] == macro_name || macro == NULL)) { std::string tid = transaction["uid"]; // Find transaction values -- cgit v1.2.3