Skip to content

Commit

Permalink
Fixed retrieving as needed doses
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGuidarini committed Dec 11, 2024
1 parent 91ca4f5 commit 9fd8176
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void DatabaseController::exportCsv(const string &exportPath, map<string, vector<

Medication DatabaseController::getMedication(long medicationId) {
string query = "SELECT * FROM " + MEDICATION_TABLE + " m "
+ " INNER JOIN " + MEDICATION_TIMES + " mt "
+ " LEFT JOIN " + MEDICATION_TIMES + " mt "
+ " ON " + "m." + MED_ID + "= mt." + MED_ID
+ " WHERE m." + MED_ID + "=" + to_string(medicationId);
Medication medication;
Expand Down Expand Up @@ -393,7 +393,11 @@ Medication DatabaseController::getMedication(long medicationId) {
}

while (!table->isAfterLast()) {
times.push_back(table->getItem(DRUG_TIME));
string t = table->getItem(DRUG_TIME);

if (!t.empty()) {
times.push_back(table->getItem(DRUG_TIME));
}

table->moveToNext();
}
Expand Down

0 comments on commit 9fd8176

Please sign in to comment.